My Oracle Support Banner

Cursor Movement in Right-to-Left JEditorPane Is Incorrect (Doc ID 1565719.1)

Last updated on FEBRUARY 14, 2024

Applies to:

Java SE JDK and JRE - Version 7 and later
Information in this document applies to any platform.

Symptoms

When editing Right-to-Left (RTL) text in a JEditorPane, the cursor movement is incorrect when a paragraph is larger than one line.  When the cursor is at the right end of the second line in the paragraph, pushing the right arrow key sets the cursor to the right end of the first line instead of the left end. Inserting normal Left-to-Right (LTR) numerals in the RTL text leads to even worse behavior. As a simple example, run the following:

Caution

This sample code in this document is provided for educational purposes only, and is not supported by Oracle Support. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using. Additionally, the code and object names used in this article represent fictitious sample names that make up an example. Any similarity to actual code is purely coincidental and not intended in any other manner.

 
Resize the resulting window so that the text is on multiple lines and then navigate to the right end of the second line. If you insert a number into the text midway on the second line and set the cursor to the left of the number and continually press left, the cursor will cycle around on the second line never moving off it. If you then add another multiple line paragraph of text after the first, navigating from the left end of the last of the first paragraph navigates to the right end of the last line of the second paragraph.  There must be a number in the first paragraph.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
 Caution
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.