| 
 Duplicate :   
 | 
|
| 
 Relates :   
 | 
|
| 
 Relates :   
 | 
|
| 
 Relates :   
 | 
|
| 
 Relates :   
 | 
FULL PRODUCT VERSION :
java version "1.7.0_04-ea"
Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b19)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b20, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.7.3
A DESCRIPTION OF THE PROBLEM :
When the ScreenMenuBar is activated using  System.setProperty("apple.laf.useScreenMenuBar", "true"); and the registered Accelerator Key for a JMenuItem is pressed, the ActionListener is called twice.
REGRESSION.  Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Activate the usage of the Screen Menu Bar
System.setProperty("apple.laf.useScreenMenuBar", "true");
Create a JFrame with a JMenuBar, JMenu and a JMenuItem and register a hotkey to the JMenuItem using setAccelerator and add an ActionListener.
Start the test application and press the Hotkey.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Having the ActionListener called once per pressed hotkey.
ACTUAL -
The ActionListener its called twice.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.InvocationTargetException;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
public class Test extends JFrame {
	public Test() {
		JMenuBar menuBar = new JMenuBar();
		JMenu fileMenu = new JMenu("File");
		JMenuItem openItem = new JMenuItem("Open");
		openItem.setAccelerator(KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
		openItem.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				System.out.println("i was called");
			}
		});
		fileMenu.add(openItem);
		menuBar.add(fileMenu);
		setJMenuBar(menuBar);
		pack();
		setVisible(true);
	}
	public static void main(String[] args) throws InvocationTargetException, InterruptedException {
		System.setProperty("apple.laf.useScreenMenuBar", "true");
		SwingUtilities.invokeAndWait(new Runnable() {
			@Override
			public void run() {
				new Test();
			}
		});
	}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not use the ScreenMenuBar.
  |