Other | Other |
---|---|
1.1.7 b01Fixed | 1.2.0Fixed |
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
Name: mc57594 Date: 02/27/97 1) In the example given, click in the red area and move the mouse out of the red area quickly. Note that DRAG events are not delivered. In addition the mouse released event is not delivered when the mouse is released. When the red component receives two mouse downs in a row without a mouse up it will print ERROR: in the output window. 2) Source Code: (Stand Alone Example) import java.awt.*; import java.awt.event.*; class DragBug extends Panel { public DragBug() { addMouseMotionListener(new IMouseMotionAdapter()); addMouseListener(new IMouseAdapter()); setBackground(Color.red); } public Dimension preferredSize() { return new Dimension(50,50); } class IMouseMotionAdapter extends MouseMotionAdapter { public IMouseMotionAdapter(){} public void mouseDragged(MouseEvent e) { System.out.println("DragBug: DragEvent"); } } class IMouseAdapter extends MouseAdapter { public IMouseAdapter(){} public void mousePressed(MouseEvent e) { System.out.println("DragBug: MousePressed"); if (ivHasMouse) { System.out.println("ERROR: Mouse pressed in a row without release!!"); } ivHasMouse = true; } public void mouseReleased(MouseEvent e) { System.out.println("DragBug: MouseReleased"); ivHasMouse = false; } } public boolean ivHasMouse = false; } public class DragBugDemo { public static void main(String args[]) { Frame f = new Frame("DragBug"); f.setLayout(new FlowLayout()); f.add(new DragBug()); f.setBounds(new Rectangle(20,20,300,300)); f.show(); } } 3) No error messages. Behvaior BUG 4) Trace from program. Notice the two mouse pressed events. and no drag events. DragBug: DragEvent DragBug: MouseReleased DragBug: MousePressed DragBug: MousePressed ERROR: Mouse pressed in a row without release!! DragBug: MouseReleased DragBug: MousePressed DragBug: MouseReleased 5)Plain Win 95 company - Shafir Inc. , email - ###@###.### ======================================================================
|