Applet in JFrame, JMenu problem
I'm having a problem with the below code, being displayed properly on windows vista. However it works on windows xp for me.
Code:
public GUI(Applet app) {
super("Title");
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
JMenuBar jmb = new JMenuBar();
// -- File --
JMenu file = new JMenu("File");
JMenuItem open = new JMenuItem("Open...");
open.setActionCommand("file-open");
open.addActionListener(this);
JMenuItem reload = new JMenuItem("Reload");
reload.setActionCommand("file-reload");
reload.addActionListener(this);
JMenuItem exit = new JMenuItem("Exit");
exit.setActionCommand("file-exit");
exit.addActionListener(this);
file.add(open);
file.add(reload);
file.add(new JSeparator());
file.add(exit);
// --
jmb.add(file);
getContentPane().add(jmb);
setJMenuBar(jmb);
getContentPane().add(app, BorderLayout.CENTER);
setSize(519, 394);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
setVisible(true);
}
What happens is:
On vista, the JMenuItem's are displayed under the applet. Instead of on top of the applet.
Why is this?
Thanks,
Bill86