Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4149062

MouseEvent: mousePressed reported 3 times when double-click

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.1.6
    • client-libs
    • x86
    • windows_nt


      The number of mouse event mousePressed created by double click is odd. Sometimes, mousePressed is reported 3 times on double click.

      STEPS: JDK 1.1.6

      1. Run attached code on Windows NT/95
      2. Double click the button and observe number increasing.
      Left box shows mouseClicked, center for mousePressed, right is mouseReleased. All three value shold be same. But mousePressed increasing by 3 when double click on button.

      -----
      import java.io.*;
      import java.awt.*;
      import java.awt.event.*;

      public class TestApp2A extends Frame implements MouseListener {
      TextField click = new TextField("0");
      TextField press = new TextField("0");
      TextField release = new TextField("0");
      Button b = new Button("Double Click!!");

      public static void main(String args[]) {
      TestApp2A ta2A = new TestApp2A();
      }
      public TestApp2A() {
      addWindowListener(new WindowAdapter() {
      public void windowClosing( WindowEvent e ) {
      System.exit(0);
      }
      });

      b.addMouseListener(this);

      setTitle("test window");
      setLayout(new FlowLayout(FlowLayout.LEFT));
      setSize(300, 100);
      add(click);
      add(press);
      add(release);
      add(b);
      setVisible(true);
      }

      public void mouseClicked(MouseEvent e) {
      int i = new Integer(click.getText()).intValue();
      i++;
      click.setText(new Integer(i).toString());
      }

      public void mousePressed(MouseEvent e) {
      int i = new Integer(press.getText()).intValue();
      i++;
      press.setText(new Integer(i).toString());
      }

      public void mouseReleased(MouseEvent e) {
      int i = new Integer(release.getText()).intValue();
      i++;
      release.setText(new Integer(i).toString());
      }

      public void mouseEntered(MouseEvent e) {
      }

      public void mouseExited(MouseEvent e) {
      }
      }

      koushi.takahashi@japan 1998-06-16

            duke J. Duke
            ktakahassunw Koushi Takahashi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: