-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.3.0
-
Cause Known
-
x86
-
windows_2000
Name: ssT124754 Date: 02/28/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Creating a GUI component under the cursor does not fire the mouseEntered()
trigger on the MouseListeners of this new component directly. The trigger
does fire however, when the mouse is moved. I would understand if the
trigger does not fire at all, but too late is unacceptable.
Below is an example illustrating this problem: click on the label to
produce a new instance of the label. I tried to find this bug in the Sun bug
database, and the nearest hit I could find is bug report 4027025 (Creating a
new component under cursor causes me to lose mouse motion events) with
status "Closed, not reproducable"
The code contains a bonus bug: uncommenting the comment and the text will be
displayed over previous text.
Greetings,
Mark Scheffer.
/* TestMouseMove 1.0 2001/02/21 */
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class TestMouseMove extends MouseInputAdapter {
public static void main(java.lang.String[] args) {
new TestMouseMove();
}
JFrame f;
JPanel p = new JPanel();
JLabel label;
public TestMouseMove() {
f = new JFrame();
f.setContentPane(p);
newButton();
f.pack();
f.setVisible(true);
}
public void newButton() {
label = new JLabel("Not on label");
label.addMouseListener(this);
label.addMouseMotionListener(this);
p.removeAll();
p.add(label);
p.revalidate();
//f.setContentPane(label);
}
public void mousePressed(MouseEvent e) {
label.setText("New label...");
}
public void mouseReleased(MouseEvent e) {
newButton();
}
public void mouseEntered(MouseEvent e) {
System.out.println("ENTER");
label.setText("On label");
}
public void mouseExited(MouseEvent e) {
System.out.println("EXIT");
label.setText("Not on label");
}
public void mouseDragged(MouseEvent e) { }
public void mouseMoved(MouseEvent e) { }
}
/* end */
(Review ID: 117431)
======================================================================
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Creating a GUI component under the cursor does not fire the mouseEntered()
trigger on the MouseListeners of this new component directly. The trigger
does fire however, when the mouse is moved. I would understand if the
trigger does not fire at all, but too late is unacceptable.
Below is an example illustrating this problem: click on the label to
produce a new instance of the label. I tried to find this bug in the Sun bug
database, and the nearest hit I could find is bug report 4027025 (Creating a
new component under cursor causes me to lose mouse motion events) with
status "Closed, not reproducable"
The code contains a bonus bug: uncommenting the comment and the text will be
displayed over previous text.
Greetings,
Mark Scheffer.
/* TestMouseMove 1.0 2001/02/21 */
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class TestMouseMove extends MouseInputAdapter {
public static void main(java.lang.String[] args) {
new TestMouseMove();
}
JFrame f;
JPanel p = new JPanel();
JLabel label;
public TestMouseMove() {
f = new JFrame();
f.setContentPane(p);
newButton();
f.pack();
f.setVisible(true);
}
public void newButton() {
label = new JLabel("Not on label");
label.addMouseListener(this);
label.addMouseMotionListener(this);
p.removeAll();
p.add(label);
p.revalidate();
//f.setContentPane(label);
}
public void mousePressed(MouseEvent e) {
label.setText("New label...");
}
public void mouseReleased(MouseEvent e) {
newButton();
}
public void mouseEntered(MouseEvent e) {
System.out.println("ENTER");
label.setText("On label");
}
public void mouseExited(MouseEvent e) {
System.out.println("EXIT");
label.setText("Not on label");
}
public void mouseDragged(MouseEvent e) { }
public void mouseMoved(MouseEvent e) { }
}
/* end */
(Review ID: 117431)
======================================================================
- relates to
-
JDK-6325737 Extended Modifiers on Mouse Events are wrong
- Closed
-
JDK-4706304 REGRESSION: JPopupMenu doesn't highlight selection on initial click
- Closed