RFR: 8370465: Right to Left Orientation Issues with MenuItem Component.

Alexander Zuev kizune at openjdk.org
Wed Oct 29 00:19:02 UTC 2025


On Fri, 24 Oct 2025 04:21:30 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Icon rendering offset is wrong for RTL orientation which is why the icon was not rendered properly..Also, LEADING horizontal text position was not accounted for..
> 
> Before fix
> 
> <img width="386" height="487" alt="image" src="https://github.com/user-attachments/assets/d33140e0-85f1-471c-abf4-bfc7992cd79e" />
> 
> With fix
> 
> <img width="384" height="491" alt="image" src="https://github.com/user-attachments/assets/9df65234-2b84-48ae-b85e-eefdbfbd544e" />

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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27968#discussion_r2471413125


More information about the client-libs-dev mailing list