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

Double click speed is not honored in KDE linux

XMLWordPrintable

    • b48
    • x86
    • linux
    • Verified

      Name: gm110360 Date: 07/21/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

      Also a problem with 1.4.2.

      ADDITIONAL OS VERSION INFORMATION :
      Linux gaz 2.4.18 #18 SMP Mon Feb 24 11:42:05 EST 2003 i686 unknown
      KDE 3.2.0

      A DESCRIPTION OF THE PROBLEM :
      Double click speed on Linux KDE in swing components does not follow preferences set in the KDE Control panel. This works fine for Solaris CDE, so it is not a UNIX issue. No matter what speed I set the double-click interval to, the double click speed recognized by swing is much much faster (too fast). This is a big problem because users think that their double clicks on tree nodes are getting ignored. Java appears to always be picking up that the system setting is 200 ms even when it has been set to something else. I have seen this behavior in both JTables and JTrees (assuming that it affects everything).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the app below. Note that when you run it, the double click speed from system properties is printed to system out.

      Twist open a node in the tree and Double click on the sub-nodes with varying speed. Note that only really fast double clicks are recognized (there is a println in mouseReleased when an event is a doubleClick event).

      Close the app and set your system pref for double click speed to be really really slow and then try again. There is no difference.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected that the double-click speed would be controlled by the system pref set in the KDE control panel like it is in WIndows and CDE Solaris.
      ACTUAL -
      Double click speed is always really fast no matter what it is set to in KDE prefs. Setting the pref has no effect on the double click speed.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.tree.*;
      import java.awt.event.MouseAdapter;
      import java.awt.event.MouseEvent;
      import java.awt.*;

      public class TestDoubleClickInterval
      {
          private JTree fTree;
          private DefaultTreeModel fModel;
          private DefaultMutableTreeNode fTopNode;

          public TestDoubleClickInterval()
          {
              JFrame f = new JFrame("Test Tree Click Behavior");
              fTopNode = new DefaultMutableTreeNode("Top Level");
              DefaultMutableTreeNode treeNode;

              for (int i = 0; i < 10; i++)
              {
                  treeNode = new DefaultMutableTreeNode("test"+i);
                  treeNode.add(new DefaultMutableTreeNode("foo"));
                  treeNode.add(new DefaultMutableTreeNode("bar"));
                  treeNode.add(new DefaultMutableTreeNode("test"));
                  fTopNode.add(treeNode);
              }
              fTree = new JTree();
              fTree.setLargeModel(true);
              fTree.setRowHeight(20);
              fModel = new DefaultTreeModel(fTopNode);
              fTree.setModel(fModel);
              fTree.setRootVisible(false); //make top node invisible
              fTree.setShowsRootHandles(true); //show tree lines
              fTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
              fTree.addMouseListener(new MyMouseAdapter());
              JScrollPane sp = new JScrollPane(fTree);
              f.getContentPane().add(sp);
              f.setSize(200,200);
              f.setLocation(300,300);
              f.setVisible(true);

              System.out.println("Multi Click interval " +((Integer) Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval")).intValue());


          }

           private class MyMouseAdapter extends MouseAdapter
          {
              public void mouseReleased(MouseEvent event)
              {
                      if (event.getClickCount() == 2)
                          System.out.println("Mouse event is a double click event");
              }
           }



          public static void main(String[] args)
          {
              new TestDoubleClickInterval();
          }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only workaround is really hacky and bound to lead to problems down the road. This would be to keep track of time between mouse clicks and when they occur within a randomly chosen threshhold (bigger than 200 ms) then the click is interpreted as a double click.
      (Incident Review ID: 285909)
      ======================================================================

            dav Andrei Dmitriev (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: