I am using BeautyEye look and feel in a Java Desktop program but recently found out JMenuBar shows empy JMenuItems as shown in the screenshot below.
As you can see the area of the menu is there but with the same colour as the Jframe contentPane and with no Menu text visible.
a sample program to test this (download the BeautyEye library from here) is:
import java.awt.*;
import javax.swing.*;
import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;
public class JavaMenuBarExample implements Runnable
{
private JFrame frame;
private JMenuBar menuBar;
private JMenu fileMenu;
private JMenuItem openMenuItem;
public static void main(String[] args)
{
try
{
BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.osLookAndFeelDecorated;
org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();
UIManager.put("RootPane.setupButtonVisible", Boolean.FALSE);
}
catch (Exception ex)
{
ex.printStackTrace();
}
// the proper way to show a jframe (invokeLater)
SwingUtilities.invokeLater(new JavaMenuBarExample());
}
@Override
public void run()
{
frame = new JFrame("Java Menubar Example");
menuBar = new JMenuBar();
fileMenu = new JMenu("File");
openMenuItem = new JMenuItem("Open");
fileMenu.add(openMenuItem);
// add menus to menubar
menuBar.add(fileMenu);
// put the menubar on the frame
frame.setJMenuBar(menuBar);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(400, 300));
frame.pack();
frame.setVisible(true);
}
}
I have been debug it use jdk 1.8_u45, it is normal at Windows platform. I guess this may be a bug for linux platform java1.8_u45.