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

Abhishek Kumar abhiscxk at openjdk.org
Wed Feb 5 14:20:18 UTC 2025


On Wed, 5 Feb 2025 02:33:04 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>>> I believe this is likely how layout is calculated.
>> 
>> I just wanted to know "why 3 is chosen as a magic number ?". Actually the spacing with "4 * OFFSET" looks better between radio, icon and text of menu item (on win 11).
>
>> > I believe this is likely how layout is calculated.
>> 
>> I just wanted to know "why 3 is chosen as a magic number ?". Actually the spacing with "4 * OFFSET" looks better between radio, icon and text of menu item (on win 11).
> 
> I guess this is now taken care of in latest PR..

@prsadhuk I tested on win11 and I think this should be OK.
Although the gap is not equal between RadioButton icon, imageIcon and text but as you said above `text location as it is done in WindowsMenuItemUI#paintText which does not have any knowledge of bullet/icon presence`, this may not be an issue.

After changing `icon.paintIcon(c, g, x - OFFSET + ((skinWidth != -1) ? skinWidth : 16), y + OFFSET);` to `icon.paintIcon(c, g, x - OFFSET + ((skinWidth != -1) ? skinWidth - 1 : 15), y + OFFSET);` looks better (my personal opinion)

Same issue exist for JCheckBoxMenuItem as well, it's better to extend the test for JCheckBoxMenuItem as well.
The components can be re-arranged in a grid panel to give better visual alignment (vertically aligned).

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

PR Comment: https://git.openjdk.org/jdk/pull/23324#issuecomment-2636977269


More information about the client-libs-dev mailing list