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

Antonio Vieiro avieiro at openjdk.org
Fri Sep 19 09:25:44 UTC 2025


On Fri, 19 Sep 2025 09:09:02 GMT, Antonio Vieiro <avieiro at openjdk.org> wrote:

>> Backport of [JDK-8348760](https://bugs.openjdk.org/browse/JDK-8348760)  (P1 - CPU25_10-critical-approved) that properly renders `JRadioButtonMenuItem`s with `ImageIcon`s in the Windows Look and Feel. 
>> 
>> Mostly clean but for copyright issues, also the multi-line string in `test/jdk/javax/swing/JMenuItem/TestRadioAndCheckMenuItemWithIcon.java` was replaced with string concatenation.
>> 
>> The issue is reproducible in OpenJDK 11 with the Windows Look and Feel on Windows 11.
>> 
>> - Passes `tier1` tests on all platforms.
>> - Passes the new (manual) test on Windows 11/x86_64 (24H2/26100.6584)
>> - SwingSet2 looks normal (tested with Windows Look And Feel and the Windows Classic Look and Feel)
>> 
>> NOTE: Related issues [JDK-8365375](https://bugs.openjdk.org/browse/JDK-8365375), [JDK-8365389](https://bugs.openjdk.org/browse/JDK-8365389)  and [JDK-8365625](https://bugs.openjdk.org/browse/JDK-8365625) (all P3) will also need to be backported.
>
> Antonio Vieiro has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Keep import wildcards in 11. Removed propertyChangeListener & doc.

I think this is ready now.

- In `WindowsMenuItemUI.java`  we just add the `installDefaults` and `applyInsets`, but also the `paintXX` methods, that are required for the fix to happen.
    - This requires two additional imports: `SwingUtilities3` and  `MenuItemLayoutHelper;`
- Doc and propertyChangeListener do not belong here and were removed. Sorry by that.
- `WindowsRadioButtonMenuItemUI.java` import rearrangement was removed too.

The test continues to pass.

<img width="640" height="344" alt="jdk-11-test" src="https://github.com/user-attachments/assets/6212d28d-0ff8-4fcb-a30d-eac5ec6b7172" />

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

PR Comment: https://git.openjdk.org/jdk11u/pull/104#issuecomment-3311420735


More information about the jdk-updates-dev mailing list