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

Alexey Ivanov aivanov at openjdk.org
Thu Feb 6 18:02:25 UTC 2025


On Wed, 5 Feb 2025 13:59:00 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> I have modified the PR to move the icon w.r.t bullet skin width and it looks like this in windows 11..I believe this should work for windows 10 also but I dont have windows10 to check
>> 
>> ![image](https://github.com/user-attachments/assets/953eee76-ee88-4189-9ed8-681854c27363)
>> 
>> 
>> I dont think we can tamper with text location as it is done in WindowsMenuItemUI#paintText which does not have any knowledge of bullet/icon presence.
>> Also, ideally I dont think this should be applicable for windows10 and we should do this only for windows11 but I am not sure if there is version check in our code and anyway, windows10 would be EOL-ed and unsupported platform in few months
>
> It looks ok in windows 11 with both icon selected/unselected
> 
> ![image](https://github.com/user-attachments/assets/34fd2ba2-40c7-47f5-a241-6f16a90d3b26)
> 
> ![image](https://github.com/user-attachments/assets/0d175b8f-f2f8-489b-a6e9-2aa9f17d1a70)
> 
> I would like to know how it looks in windows 10? Is there any issue?
> 
> Although, as per https://bugs.openjdk.org/browse/JDK-8349268 windows 10 is not supported in JDK25 and this fix is going in mainline jdk25

> I dont think we can tamper with text location as it is done in WindowsMenuItemUI#paintText which does not have any knowledge of bullet/icon presence.

Why can't we?

`paintText` paints the text into a rectangle that's passed to it. It's up to menu layout code to determine at what location the text should be painted.

If we want to mimic Windows 11 File Explorer menu, which we should because it's the platform app that renders both radio-bullets and icons in its menu, then we need to update the menu layout code — otherwise the spacing between icons and text is way off.

The currently suggested fix can be used as a workaround, however, I'd rather we do it in a consistent way with what Windows 11 File Explorer does.

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

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


More information about the client-libs-dev mailing list