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

JTextfield mouse click is imprecise

XMLWordPrintable

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b03)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP 32 bit

      A DESCRIPTION OF THE PROBLEM :
      When selecting text in a JTextfield the selection is imprecise. When you click somewhere between two letters the caret will not start blinking between where you clicked. Instead the caret will be placed one character to the left.

      This behavior does not seem to be specific to a LAF. I tried both regular LAF and Nimbus with same results.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Type some 5 letters
      2. Try clicking after the 4th letter to place the caret there

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The caret should now be placed after the 4th letter
      ACTUAL -
      The caret is placed after the third letter.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      JTextField field = new JTextField();
      field.setPreferredSize(new Dimension(100, 24));

      JPanel panel = new JPanel();
      panel.add(field);

      JFrame frame = new JFrame();
      frame.add(panel);
      frame.setSize(new Dimension(300, 400));
      frame.setVisible(true);
      ---------- END SOURCE ----------

      Release Regression From : 6u13
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            peterz Peter Zhelezniakov
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: