RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v6]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Feb 5 14:01:22 UTC 2025
On Tue, 4 Feb 2025 13:15:50 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>>> But that's what I believe is been done now in the PR test, corresponding to your 1st image and corresponds to windows11
>>
>> No, it doesn't.
>>
>> On Windows 10 which has a selected background around the bullet, it looks completely off.
>>
>> 
>>
>> 
>>
>> [The original behaviour](https://github.com/openjdk/jdk/pull/23324#issuecomment-2624726843) was consistent at least.
>>
>> Yet what the currently proposed fix produces doesn't look right at all.
>>
>> The bullet or check-mark should remain centered in their own place as if there's no icon.
>>
>>> Are you suggesting to keep more gap in between checkmark and button?
>>
>> Yes, but not only.
>>
>> If there's an icon, it should move the text to the right to accommodate the additional icon, if we're going this route.
>>
>> In addition to that, the text in all other menu items should move to the right for consistency so that all the menu items are aligned and items without an icon render an empty icon in this case.
>>
>> We may introduce a property that controls this behaviour: whether the text aligns in all the menu items or not.
>>
>> The first option corresponds to this layout:
>> 
>> where all the text moves right to add space for menu icons. This corresponds to menu layout in File Explorer in Windows 11.
>>
>> The second option corresponds to this layout:
>> 
>> where the second menu item remains at the position where it's rendered now.
>
> 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
>
> 
>
>
> 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


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
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r1942995657
More information about the client-libs-dev
mailing list