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

Double-click in TextField sets caret to the beginning

XMLWordPrintable

    • b43
    • x86
    • windows_7

        FULL PRODUCT VERSION :
        java version "1.7.0"
        Java(TM) SE Runtime Environment (build 1.7.0-b147)
        Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        When double-clicking with the mouse in a java.awt.TextField the caret is set to the beginning. One would expect the selection of the word lying under the mouse cursor. Works fine with javax.swing.JTextField though.

        REGRESSION. Last worked in version 6u26

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        In the executable test case below, double-click anywhere in the TextField.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Word under the mouse cursor is selected.
        ACTUAL -
        Caret was set to the beginning.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.EventQueue;
        import java.awt.Frame;
        import java.awt.TextField;

        public class TextFieldTest {
        public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
        final Frame frame = new Frame();
        frame.add(new TextField("Lorem ipsum."));
        frame.pack();
        frame.setVisible(true);
        }
        });
        }
        }
        ---------- END SOURCE ----------

              alexsch Alexandr Scherbatiy
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: