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

Different behaviour of MouseEvent.getClickCount across platforms

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_8

      Description

      On windows, mouse release event has the same click count as corresponding
      mouse press event. On Solaris, mouse release event has zero click count
      if there was drag between press and release.
      This can be reproduced with merlin build b55 using the following testcase:

      import java.awt.*;
      import java.awt.event.*;

      public class MouseTest extends MouseAdapter {
          public static void main(String[] args) {

              MouseTest mt = new MouseTest("window");

              Frame f = new Frame("test");

              f.setLayout(new FlowLayout());

              f.addMouseListener(mt);

              f.setBounds(0, 0, 400, 400);
              f.setVisible(true);
          }

          private String name;

          public MouseTest(String name) {
              this.name = name;
          }

          public String getName() {
              return name;
          }

          public void mouseClicked(MouseEvent e) {
              System.out.println(getName() + " clicked");
              System.out.println("Click count " + e.getClickCount());
          }

          public void mousePressed(MouseEvent e) {
              System.out.println(getName() + " pressed");
              System.out.println("Click count " + e.getClickCount());
          }

          public void mouseReleased(MouseEvent e) {
              System.out.println(getName() + " released");
              System.out.println("Click count " + e.getClickCount());
          }
      }

      Events and coresponding click counts will be displayed in the console.
      Press the mouse, drag it a little and release.
      On windows, you will see click count: 1 (or more, if there were more
      clicks before drag), on Solaris, you will see click count: 0. If you
      click without drag, everything works fine for both platforms.

        Attachments

          Activity

            People

            Assignee:
            dav Andrei Dmitriev (Inactive)
            Reporter:
            ibdsunw Ibd Ibd (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: