RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v11]
Alexey Ivanov
aivanov at openjdk.org
Mon Feb 10 17:40:25 UTC 2025
On Mon, 10 Feb 2025 16:23:23 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:
>
> Restore Windows 10 behavior
Changes requested by aivanov (Reviewer).
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java line 663:
> 661: paintIcon(g, lh, lr, holdc);
> 662: if (UIManager.getLookAndFeel().getName().equals("Windows")
> 663: && System.getProperty("os.name").equals("Windows 11")
It's not what I meant.
I suggested painting the menu items *the same way* for Windows 10 and 11. Yet the layout for Windows 11 should be tweaked.
To be clear, the bullet / check-mark is painted at the same location where it would be painted if there were no custom icon for both Windows 10 and 11. The custom icon is painted to the right of the bullet / check-mark, and the menu text moves farther to the right.
src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java line 886:
> 884: skin.paintSkin(g, x - OFFSET, y + OFFSET, state);
> 885: }
> 886: } else {
Again, it's not what I meant.
Both Windows 10 and 11 should follow the same layout — the new style that you found in File Explorer in Windows 11.
-------------
PR Review: https://git.openjdk.org/jdk/pull/23324#pullrequestreview-2606681172
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r1949596849
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r1949599874
More information about the client-libs-dev
mailing list