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:

![The screenshot of the newly added test case `TestImageIconWithJRadioButtonMenuItem.java` on Windows 10: it renders an unselected radio button control to the left of menu item which has an icon in addition to text](https://github.com/user-attachments/assets/2d5d47cb-7de5-41e0-9b14-e7994d4a9991)

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