RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v31]
Alexey Ivanov
aivanov at openjdk.org
Mon Jun 30 14:48:44 UTC 2025
On Mon, 30 Jun 2025 05:57:30 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:
>
> Alignment fix
src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java line 928:
> 926: getIconWidth(), getIconHeight(), backgroundState);
> 927: skinWidth = getIconWidth();
> 928: skin = xp.getSkin(c, part);
What I expect to see here is that the skin is always painted at (`x + OFFSET, y + OFFSET`)
skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
in both Windows 10 and 11.
The check mark and bullet have to remain on their own designated place.
src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java line 940:
> 938: icon.paintIcon(c, g, x + icon.getIconWidth(),
> 939: y + OFFSET);
> 940: }
If an icon is present, it gets painted instead of check mark or bullet in Windows 10.
In Windows 11 the icon gets painted on
* on the same location in regular case when the current popup menu contains no check or radio menu items with an icon;
* on its own column with has proper large margins when there's at least one check or radio menu item with an icon; the size of the entire popup has to increase to allocate space for the icon column.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2175235234
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2175244401
More information about the client-libs-dev
mailing list