<Swing Dev> RFR: 4710675: JTextArea.setComponentOrientation does not work with correct timing [v2]

Sergey Bylokhov serb at openjdk.java.net
Fri Feb 26 05:26:41 UTC 2021


On Thu, 25 Feb 2021 04:37:01 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> It is seen JTextArea.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT) orientation is not honoured if it is called after setText() and remain at LTR orientation. It changes the orientation only if some more text is typed additionally to existing text.
>> This behaviour is different from JTextField where the RTL orientation is honoured from start.
>> Proposed fix is to check for ComponentOrientation propertyChange event and set i18n property if it is not set, so that orientation is honoured as soon as setComponentOrientation() is called.
>> Checked for all L&Fs in all supported platforms.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove robot reliance

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java line 1914:

> 1912:                 final String I18NProperty = "i18n";
> 1913:                 if (ComponentOrientation.RIGHT_TO_LEFT == newValue
> 1914:                     && ! Boolean.TRUE.equals(document.getProperty(I18NProperty))) {

Please add a comment similar to the text in the AbstractDocument.handleInsertString, otherwise, it is unclear why we need to enable "complex layout".

-------------

PR: https://git.openjdk.java.net/jdk/pull/2673


More information about the swing-dev mailing list