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

Alexey Ivanov aivanov at openjdk.org
Thu Feb 6 17:56:15 UTC 2025


On Tue, 4 Feb 2025 14:16:16 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> When JRadioButtonMenuItem is called with imageIcon, then only imageIcon is shown without radiobutton in WIndowsLookAndFeel as there was no provision of drawing the radiobutton alongside icon.
>> If icon is not there, the radiobutton is drawn. Added provision of drawing the radiobutton windows Skin even when imageIcon is present.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   retain diff of OFFSET between skin background start coord and skin coordinate

I tested it on Windows 11 and 10.

**Windows 11**  
![Windows-11-menu-items-2025-02-06](https://github.com/user-attachments/assets/e368f0ce-3c0f-45d6-a485-3c5331471204)  
It looks reasonably well…

But it doesn't look like the menu in Windows 11 File Explorer, does it?  
![Windows 11 File Explorer View with icons (100%)](https://github.com/user-attachments/assets/53fd8ba9-00f7-4126-a238-ab162ff54325)  
Windows L&F should look like native apps do, and we're not there yet with the menu rendering.

**Windows 10**  
![Windows-10-menu-items-2025-02-06](https://github.com/user-attachments/assets/e2d64c81-3831-4f20-93ea-f9e85f5ce5aa)  
It looks bad because neither icon is where it should be.

Without the fix, it looks good:  
![Windows-10-menu-items-no-fix-2025-02-06](https://github.com/user-attachments/assets/684c9461-e47e-46de-a609-7bd9724099cb)  
And one can see if an item is selected or not. Yet they changed the skin in Windows 11, now it's impossible to tell distinguish them.

---

The updated test is available at [commit 7aa4de1](https://github.com/openjdk/jdk/blob/7aa4de1b5446126a7732f11a6c94839a396ff8bf/test/jdk/javax/swing/JMenuItem/TestImageIconWithJRadioButtonMenuItem.java).

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

PR Comment: https://git.openjdk.org/jdk/pull/23324#issuecomment-2640591767


More information about the client-libs-dev mailing list