On Mon, 22 Feb 2021 09:45:31 GMT, Prasanta Sadhukhan <psadhuk...@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.

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

> 1906:             if ("focusAccelerator" == propertyName) {
> 1907:                 updateFocusAcceleratorBinding(true);
> 1908:             } else if ("componentOrientation" == propertyName) {

It is not a part of the fix, but shouldn't we use `equals()` instead of `==` 
for String comparison?

Please also update the copyright year.

test/jdk/javax/swing/JTextArea/JTextAreaOrientationTest.java line 48:

> 46:     static Rectangle bounds;
> 47: 
> 48:     public static boolean compareBufferedImages(BufferedImage 
> bufferedImage0, BufferedImage bufferedImage1) {

We could probably reuse `Util.compareBufferedImages()` from `regtesthelpers` 
here.

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

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

Reply via email to