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

Windows: Textfield cursor appears at a different location when clicked after setting echo character

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      I've a text field on a Frame. Frame contains some text, I copy some text from the text field and paste it repeatedly on the text field. After this, the echo character of the text field is changed. Now, if mouse is clicked on the text field, the blinking cursor appears at a different location.

      This is reproducible only on windows, from 1.4.2 onwards

      To reproduce:
      1. Run the below testcase
      2. Select some text from the text field using mouse and type ctrl+c to copy the text
      3. Click on the text field and type ctrl+v repeatedly to paste the text on the text field.
      4. Change the echo character by clicking 'Set echo character' button.
      5. Mouse the mouse and click it on the text field.It could be seen that the blinking cursor appears at a location different from where mouse was clicked.


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

      public class TextFieldTest {
          
          private static TextField tf;
          
          public static void main(String[] args) {
              Frame f = new Frame();
              tf = new TextField(30);
              tf.setText("a very long text present in the text field. The echo character will be changed soon after text is copied");
              f.setLayout(new FlowLayout());
              f.add(tf);
              Button b2 = new Button("Set echo char");
              b2.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent event) {
                      tf.setEchoChar('a');
                  }
              });
              f.add(b2);
              f.setSize(200, 200);
              f.setVisible(true);
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              dcherepanov Dmitry Cherepanov
              Reporter:
              gramachasunw Girish Ramachandran (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: