On Mon, 22 Feb 2021 12:42:20 GMT, Alexander Zvegintsev <[email protected]>
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.
>
> 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.
I intentionally didn't use Util library so I could use it as standalone test.
> 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.
I dont see the need. Also, it's not mandatory to change the copyright year
which will be taken care of by script at end of release.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2673