[jdk8u] RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel
Severin Gehwolf
sgehwolf at openjdk.org
Thu Sep 25 18:42:36 UTC 2025
On Thu, 25 Sep 2025 07:11:15 GMT, Antonio Vieiro <avieiro at openjdk.org> wrote:
> Backport of [JDK-8348760](https://bugs.openjdk.org/browse/JDK-8348760) (P1 - CPU25_10-critical-approved) and [JDK-8365375](https://bugs.openjdk.org/browse/JDK-8365375) from jdk11u, that properly renders JRadioButtonMenuItems with ImageIcons in the Windows Look and Feel on Windows 11.
>
> The new test `test/jdk/javax/swing/JMenuItem/TestRadioAndCheckMenuItemWithIcon.java` has been slightly refactored in a second commit, since `PassFailJFrame` is not available in `/java/awt/regtesthelpers` in JDK8.
>
> - Passes tier1 tests on all platforms.
> - Passes the new (manual) test on Windows 11/x86_64 (24H2/26100.6584)
>
> NOTE: Related issues[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.
There were small differences to the JDK 11 backport:
diff --git a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
index c0286a74e1..c29297a630 100644
--- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
+++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
index 78b11147a7..7fda45b254 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
@@ -785,6 +785,7 @@ public class WindowsIconFactory implements Serializable
}
assert menuItem == null || c == menuItem;
Icon icon = getIcon();
+
if (type == JCheckBoxMenuItem.class
|| type == JRadioButtonMenuItem.class) {
AbstractButton b = (AbstractButton) c;
Please include them so that the patches are more alike. Seems fine otherwise.
-------------
Changes requested by sgehwolf (Reviewer).
PR Review: https://git.openjdk.org/jdk8u/pull/78#pullrequestreview-3269029414
More information about the jdk8u-dev
mailing list