RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v30]

Alexey Ivanov aivanov at openjdk.org
Fri Jun 27 11:46:45 UTC 2025


On Fri, 27 Jun 2025 03:44:23 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java line 234:
>> 
>>> 232:         }
>>> 233:         return iconPresent;
>>> 234:     }
>> 
>> This should be really simple:
>> 
>> 
>>     private static boolean checkIfImageIconPresent(JMenuItem mi) {
>>         return (mi instanceof JCheckBoxMenuItem
>>                 || mi instanceof JRadioButtonMenuItem)
>>                && mi.getIcon() != null;
>>     }
>> 
>> 
>> That is
>
> Have you checked this code? It doesn't work for me
> 
> I get this whereby JRadioButtonMenuItem3 which doesnt have imageicon is not aligned..For this only, we need to know if other RBMIs have imageicon from ButtonGroup or if there any other way, let me know..
> 
> ![image](https://github.com/user-attachments/assets/eb2d701e-f235-4527-9f80-e372586fc16a)

No, I didn't.

It doesn't work because the overall menu layout isn't right at the moment. If you implement [four-column layout](https://github.com/openjdk/jdk/pull/23324#issuecomment-3008593168): check mark / bullet, icon, text, accelerator, it would work. Just like the text of **MenuItem1** and **JCheckBoxMenuItem 3** would be aligned to the text of other menu items.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2171742764


More information about the client-libs-dev mailing list