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

Alexey Ivanov aivanov at openjdk.org
Thu Jan 30 14:44:48 UTC 2025


On Thu, 30 Jan 2025 13:28:00 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> The bug says
> 
> > in case icon is defined for JCheckBoxMenuItem or
> > JRadioButtonMenuItem this icon is used as a check/radio mark. themed
> > background is used to show the selection.
> 
> so I guess it was done intentionally to not draw checkmark if icon is there, but I am not getting any menuitem with icon and radiobutton selection natively in windows11 to compare..anything in windows10?

I think so. Vista and Windows 7 had a kind of separator in the menu between text and icons.

![Notepad - selected Word wrap in Windows 7](https://github.com/user-attachments/assets/81315ca3-5567-4cdf-8a2a-3bffd413b2b8)  
This screenshot shows how menu looked like in Windows 7, the *Word Wrap* item is selected.

I don't think Windows has ever supported both icons and bullets / check marks… unless you drew menu items yourself.

The icons in menus were always displayed in that area. The right-click menu on the desktop in Windows 10 is a good example; Windows 11 uses a completely different style of menus on the desktop and in Explorer.


I can't find any native Windows app which displayed both states. The closest I found are Paint.NET and VirtualBox.

Paint.NET  
![Paint NET - selected menu item](https://github.com/user-attachments/assets/1545d3a7-4354-4aac-90c9-92da0c98a713)

Here *Pixel Grid* is selected. It uses a selected background and a highlight square around the icon. The *Pixels* item is also selected, but it has no icon, it displays a check-mark (even though it should've been a bullet: only one of _Pixels_, _Inches_, _Centimeters_ can be selected).

VirtualBox  
![VirtualBox - selected Pause](https://github.com/user-attachments/assets/777f45d8-5ac0-4bc6-ae88-77f43c063704)

In this case, the *Pause* item is selected. VirtualBox adds both a selected background as well as a check-mark overlay to indicate the item is currently selected.

Neither Paint.NET nor VirtualBox fully rely on Windows to render their menus, either app uses owner-drawn menus or its own controls.

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

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


More information about the client-libs-dev mailing list