On Mon, 1 Jun 2026 06:49:49 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> [JDK-8348760](https://bugs.openjdk.org/browse/JDK-8348760) fixed an issue in 
>> Windows L&F JMenuItem layout whereby radio bullet/checkmark was rendered in 
>> different columnspace than menuitem imageicon so radiobullet/checkmark is 
>> rendered in first column and imageicon is rendered in 2nd column but this 
>> rendering of imageicon in 2nd columnspace was done invariably for all 
>> JMenuItem irrespective of if it is JRadioButtonMenuItem or JCheckBoxMenuItem 
>> or JMenuItem, which is wrong.
>> 
>> Normal JMenuItem (which are not JRadioButtonMenuItem or JCheckBoxMenuItem) 
>> imageicon rendering should be done in first columnspace as was done before 
>> JDK-8348760 fix because there is no radiobullet/checkmark to render for 
>> those menuitems so no need to reserve columnspace for those bullet/checkmark 
>> icon
>> 
>> Before fix
>> 
>> <img width="205" height="127" alt="image" 
>> src="https://github.com/user-attachments/assets/13a1e352-5e8d-4251-b7a7-032935eab74e";
>>  />
>> 
>> 
>> After fix
>> 
>> <img width="195" height="131" alt="image" 
>> src="https://github.com/user-attachments/assets/84ec3ee6-2823-4bf7-840d-b53f2e9d44c3";
>>  />
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Fix update as per rules

src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java line 160:

> 158:     }
> 159: 
> 160:     public static boolean isCheckBulletAndIconPresent;

static ? This can't possibly work if you have 2 windows with menus. Or even 2 
menus on the same window.
Or popups ... etc.

src/java.desktop/share/classes/sun/swing/MenuItemLayoutHelper.java line 463:

> 461:     public int iconTextGap;
> 462:     public void allocateIconTextGap(int iconTextGap) {
> 463:         System.out.println("******* allocateIconTextGap " + iconTextGap);

is this debugging ?

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
 line 223:

> 221:                 acceleratorFont, 
> MenuItemLayoutHelper.useCheckAndArrow(menuItem),
> 222:                 prefix);
> 223:         System.out.println("paintMenuItem mi " + mi + " 
> isCheckBulletAndIconPresent " + 
> SwingUtilities3.isCheckBulletAndIconPresent());

more debugging ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29730#discussion_r3336548688
PR Review Comment: https://git.openjdk.org/jdk/pull/29730#discussion_r3336550601
PR Review Comment: https://git.openjdk.org/jdk/pull/29730#discussion_r3336553045

Reply via email to