RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v5]
Alexey Ivanov
aivanov at openjdk.org
Thu Jan 30 12:58:48 UTC 2025
On Thu, 30 Jan 2025 12:49:14 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 two additional commits since the last revision:
>
> - Remove duke
> - RadioButton not drawn. ImageIcon on the fly
This does not look right at all:

You shouldn't render an unselected radio button in menu.
(Yes, I modified your test case to display the menu items in a popup menu as they're supposed to be.)
The position of the image also seems off. On Windows 10, the selected state has a background which you can see on the screenshot. Without the fix, the duke is centered in this selected background; but with the fix, it's off.
If we add support for painting both an `ImageIcon` and the bullet / check-mark, the layout of the menu item has to change.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23324#issuecomment-2624442850
More information about the client-libs-dev
mailing list