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

Alexey Ivanov aivanov at openjdk.org
Mon Feb 10 16:34:14 UTC 2025


On Mon, 10 Feb 2025 05:28:50 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> > It's close, yet the spacing is wrong.
> >
> > The bullet / check-mark should be where they were before the fix. There was 8-pixel margin to the left of selected bullet background before the fix, now there are only 2 pixels.
> >
> > The margin between the bullet background and the text was again 8 pixels, I think we should maintain the same margin between the bullet and the icon as well as between the icon and the menu text.
> 
> Does bullet/checkmark use to appear before the fix in windows 10? I thought you told the icon was getting highlighted/dehighlighted depending on item is selected or not

That's right! The `ImageIcon` was painted instead of bullet or check-mark.

Now that you moved the `ImageIcon` to the right, the bullet or check-mark has to be painted where the bullets and check-marks are painted when there's no custom icon.

That's what I meant — the previous location of the bullet / check-mark should be preserved.

> I am not sure if we can make 8 pixel margin as it will cause MenuItem text or bullet to be outgrow popupmenu width ( I faced this issue while experimenting with spacing), which I am not sure if and where we can increase.

This is why I say that the layout and therefore the width of the menu item has to be updated.

Previously, the custom icon was painted over, or instead of, the bullet or check-mark.

This PR proposes painting the custom icon separately, which means the width of the menu item has increase to accommodate the margins around the custom icon as well as the icon itself.

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

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


More information about the client-libs-dev mailing list