RFR: 8370465: Right to Left Orientation Issues with MenuItem Component [v3]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Oct 29 10:47:54 UTC 2025
On Wed, 29 Oct 2025 03:08:48 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> 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..
>
> Before fix
>
> <img width="302" height="188" alt="Image" src="https://github.com/user-attachments/assets/3c7dd877-da0a-44dd-8e1e-8486344b36da" />
>
> After fix
>
> <img width="196" height="120" alt="Image" src="https://github.com/user-attachments/assets/14aed6e1-2b42-4d10-9a4d-a4cc4f9f230a" />
>
> Others are working as I can see "horizontalAlignment = LEFT..." and "horizontalAlignment=RIGHT" which uses LEFT and RIGHT horizontal text positioning
>
> <img width="536" height="189" alt="Image" src="https://github.com/user-attachments/assets/b6e9b91d-e388-4e01-9243-c08b26bfc370" />
Actually I have modified the PR to rectifying layouting ensuring radiobutton bullet/checkmark are drawn at dedicated position and doesn't interfere with icon position for RTL too..Previous PR iteration was not taking into account of this for RTL so if the menuitem was selected in RTL, it was not shown..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27968#discussion_r2472508153
More information about the client-libs-dev
mailing list