Saeid Nourian
Saeid Nourian

Reputation: 1778

Javafx TextField positions the caret incorrectly after pressing delete key

Try this simple Javafx code:

TextField text1 = new TextField("abc");
TextField text2 = new TextField("abc");
HBox root = new HBox(text1, text2);
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
stage.show();

Now if you click on the TextField to position the caret right before "b" character, then if you press DEL key to delete "b" you will notice that often the caret is shifted one character to the left instead staying put:

enter image description here

enter image description here

Note: You have to use your mouse to click on "b" to move the caret there. If you use your keyboard arrow keys to move the caret there then this bug won't happen.

You may have to repeat this a few times to be able to see this effect. In my Windows 10 computer it occurs more than 70% of times.

Is this a known bug? Is there a workaround?

Upvotes: 3

Views: 608

Answers (1)

Saeid Nourian
Saeid Nourian

Reputation: 1778

I reported this issue to OpenJDK:

https://bugs.openjdk.java.net/browse/JDK-8248914

The OpenJDK developers have confirmed that this is a real bug.

Upvotes: 1

Related Questions