1 /*
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
124 if (fIconPane.mouseInIcon(e)) {
125 if (fDockLabel != null) fDockLabel.hide();
126 try {
127 fFrame.setIcon(false);
128 } catch(final PropertyVetoException e2) {}
129 } else {
130 fIconPane.repaint();
131 }
132 }
133 }
134
135 // if the mouse was completely outside fIconPane, hide the label
136 if (fDockLabel != null && !fIconPane.getBounds().contains(e.getX(), e.getY())) fDockLabel.hide();
137 }
138
139 @Override
140 @SuppressWarnings("deprecation")
141 public void mouseEntered(final MouseEvent e) {
142 if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
143 String title = fFrame.getTitle();
144 if (title == null || title.equals("")) title = "Untitled";
145 fDockLabel = new DockLabel(title);
146 fDockLabel.show(fDesktopIcon);
147 }
148
149 @Override
150 @SuppressWarnings("deprecation")
151 public void mouseExited(final MouseEvent e) {
152 if (fDockLabel != null && (e.getModifiers() & InputEvent.BUTTON1_MASK) == 0) fDockLabel.hide();
153 }
154
155 @Override
156 public void mouseClicked(final MouseEvent e) { }
157
158 @Override
159 public void mouseDragged(final MouseEvent e) { }
160
161 @Override
162 public void mouseMoved(final MouseEvent e) { }
163
164 @SuppressWarnings("serial") // Superclass is not serializable across versions
|
1 /*
2 * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
124 if (fIconPane.mouseInIcon(e)) {
125 if (fDockLabel != null) fDockLabel.hide();
126 try {
127 fFrame.setIcon(false);
128 } catch(final PropertyVetoException e2) {}
129 } else {
130 fIconPane.repaint();
131 }
132 }
133 }
134
135 // if the mouse was completely outside fIconPane, hide the label
136 if (fDockLabel != null && !fIconPane.getBounds().contains(e.getX(), e.getY())) fDockLabel.hide();
137 }
138
139 @Override
140 @SuppressWarnings("deprecation")
141 public void mouseEntered(final MouseEvent e) {
142 if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
143 String title = fFrame.getTitle();
144 if (title == null || title.isEmpty()) title = "Untitled";
145 fDockLabel = new DockLabel(title);
146 fDockLabel.show(fDesktopIcon);
147 }
148
149 @Override
150 @SuppressWarnings("deprecation")
151 public void mouseExited(final MouseEvent e) {
152 if (fDockLabel != null && (e.getModifiers() & InputEvent.BUTTON1_MASK) == 0) fDockLabel.hide();
153 }
154
155 @Override
156 public void mouseClicked(final MouseEvent e) { }
157
158 @Override
159 public void mouseDragged(final MouseEvent e) { }
160
161 @Override
162 public void mouseMoved(final MouseEvent e) { }
163
164 @SuppressWarnings("serial") // Superclass is not serializable across versions
|