-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b47
-
x86
-
linux, linux_ubuntu
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2224773 | 7u6 | Pavel Porvatov | P3 | Closed | Fixed | b22 |
Using JDK 6 or 7, run any Swing app with a menu bar, e.g.
import com.sun.java.swing.plaf.gtk.GTKLookAndFeel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
public class Demo {
public static void main(String... args) throws Exception {
UIManager.setLookAndFeel(new GTKLookAndFeel());
JMenuItem exitItem = new JMenuItem("Exit");
exitItem.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
JMenu fileMenu = new JMenu("File");
fileMenu.add(exitItem);
JMenuBar bar = new JMenuBar();
bar.add(fileMenu);
JFrame frame = new JFrame("Demo");
frame.setJMenuBar(bar);
frame.setBounds(100, 100, 300, 100);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
in Ubuntu 12.04 using the default Ambiance theme. The menu bar will be visible, but the text ("File") will be in dark grey on black, nearly unreadable. The menu text is only readable when the menu is selected.
import com.sun.java.swing.plaf.gtk.GTKLookAndFeel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
public class Demo {
public static void main(String... args) throws Exception {
UIManager.setLookAndFeel(new GTKLookAndFeel());
JMenuItem exitItem = new JMenuItem("Exit");
exitItem.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
JMenu fileMenu = new JMenu("File");
fileMenu.add(exitItem);
JMenuBar bar = new JMenuBar();
bar.add(fileMenu);
JFrame frame = new JFrame("Demo");
frame.setJMenuBar(bar);
frame.setBounds(100, 100, 300, 100);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
in Ubuntu 12.04 using the default Ambiance theme. The menu bar will be visible, but the text ("File") will be in dark grey on black, nearly unreadable. The menu text is only readable when the menu is selected.
- backported by
-
JDK-2224773 Unreadable menu bar with Ambiance theme in GTK L&F
-
- Closed
-
- duplicates
-
JDK-7174221 JMenu has dark foreground in Ambiance theme of Ubuntu and native L&F
-
- Closed
-