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

Alexey Ivanov aivanov at openjdk.org
Thu Jun 26 15:28:49 UTC 2025


On Thu, 26 Jun 2025 03:09:29 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 33 additional commits since the last revision:
> 
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into JDK-8348760
>  - Windows 10 offset correction without icon
>  - Fix issue for presence of gap between buller and text only if atleast 1 menuitem has imageicon
>  - Text alignment fix
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into JDK-8348760
>  - Review comments fix
>  - Expand wildcard imports
>  - Remove unneeded methods
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into JDK-8348760
>  - Code duplication removed
>  - ... and 23 more: https://git.openjdk.org/jdk/compare/0f1a141e...ea1016fc

src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java line 158:

> 156:     }
> 157: 
> 158:     public static void applyInsets(Rectangle rect, Insets insets) {

Isn't a similar helper function already exists…

src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java line 163:

> 161:             rect.y += insets.top;
> 162:             rect.width -= (insets.right + rect.x);
> 163:             rect.height -= (insets.bottom + rect.y);

Suggestion:

            rect.width -= (insets.right + insets.left);
            rect.height -= (insets.bottom + insets.top);

The formula doesn't look right. Why do you subtract `rect.x` and `rect.y` instead of `insets.left` and `insets.top`?

This would work correctly if both `rect.x` and `rect.y` are zero, but it would give wrong results in other cases.

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

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


More information about the client-libs-dev mailing list