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

Sergey Bylokhov serb at openjdk.java.net
Wed Feb 24 20:31:43 UTC 2021


On Mon, 22 Feb 2021 09:45:31 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.

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

> 110:             bounds = frame.getBounds();
> 111:         });
> 112:         BufferedImage img = robot.createScreenCapture(bounds);

Probably you do not need a robot just to see the difference in the rendering? Just draw to the buffered image and compare.

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

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


More information about the swing-dev mailing list