JMenuBar not working for JApplet in Firefox on Mac

I’m having this issue with Firefox 12.0 on Mac OS X 10.7.4 using the following code:

import javax.swing.*;

public class AppletWithMenuBar extends JApplet {
	public void init() {
		JMenuBar menuBar = new JMenuBar();

		JMenu fileMenu = menuBar.add(new JMenu("File"));
		fileMenu.add(new JMenuItem("New"));
		fileMenu.add(new JMenuItem("Open"));
		fileMenu.add(new JMenuItem("Save"));

		JMenu editMenu = menuBar.add(new JMenu("Edit"));
		editMenu.add(new JMenuItem("Cut"));
		editMenu.add(new JMenuItem("Copy"));
		editMenu.add(new JMenuItem("Paste"));

		setJMenuBar(menuBar);
	}
}

and

<applet code="AppletWithMenuBar.class" width="400" height="100"></applet>

Whenever I select an item from the “Edit” menu the “File” menu gets highlighted.

Check it out for yourself here or have a look at the videos below.

This issue is also discussed here.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>