RFR: 8370465: Right to Left Orientation Issues with MenuItem Component [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Oct 29 03:18:38 UTC 2025
On Wed, 29 Oct 2025 00:07:06 GMT, Alexander Zuev <kizune at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - unused import removed
>> - formatting
>> - Use existing check
>
> src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java line 918:
>
>> 916: }
>> 917: if (icon != null) {
>> 918: if (!c.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) {
>
> Why not just if(c.getComponentOrientation().isLeftToRight()) ? Then you will not need the extra import and the documentation for ComponentOrientation clearly says that direct comparison should be avoided.
Yes, I have modified to use the existing LTR check already used in the file
> src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java line 205:
>
>> 203: if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) {
>> 204: Rectangle rect = lr.getTextRect();
>> 205: if (menuItem.getHorizontalTextPosition() != SwingConstants.LEADING) {
>
> Not sure i understand why we only checking for "LEADING" text position. What if it is specified specifically as "LEFT" or "RIGHT"? What would result look like in the different component orientations with this fix?
LEADING causes the text to appear before icon so need to account for it..Others are working as I can see "Icon at the left..." and "Icon at the right.." which uses LEFT and RIGHT horizontal text positiong
<img width="506" height="159" alt="image" src="https://github.com/user-attachments/assets/d1b84789-223b-4130-9295-a7a4ddc6fa3d" />
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27968#discussion_r2471606468
PR Review Comment: https://git.openjdk.org/jdk/pull/27968#discussion_r2471608490
More information about the client-libs-dev
mailing list