Skip to content

8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus LookAndFeel #25907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class RightLeftOrientation {

static volatile JFrame frame;

private static final String INSTRUCTIONS = """
A menu bar is shown containing a menu for each look and feel.
A disabled menu means that the look and feel is not available for
Expand All @@ -83,7 +86,7 @@ public static void main(String[] args) throws Exception {
}

private static JFrame createTestUI() {
JFrame frame = new JFrame("RightLeftOrientation");
frame = new JFrame("RightLeftOrientation");
JMenuBar menuBar = new JMenuBar();

menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel",
Expand All @@ -100,14 +103,15 @@ private static JFrame createTestUI() {


static JMenu createMenu(String laf, String name) {
JMenu menu = new JMenu(name);
JMenu menu;
try {
LookAndFeel save = UIManager.getLookAndFeel();
UIManager.setLookAndFeel(laf);
SwingUtilities.updateComponentTreeUI(frame);
menu = new JMenu(name);
addMenuItems(menu, ComponentOrientation.LEFT_TO_RIGHT);
menu.addSeparator();
addMenuItems(menu, ComponentOrientation.RIGHT_TO_LEFT);
UIManager.setLookAndFeel(save);
} catch (Exception e) {
menu = new JMenu(name);
menu.setEnabled(false);
Expand Down