Refer to AWT Threading Issues for details on AWT's threading model. @param l the action listener. @see #removeActionListener @see #getActionListeners @see ae.java.awt.event.ActionEvent @see ae.java.awt.event.ActionListener @since JDK1.1
266267268269270271272273274275
menuItem = new CheckboxMenuItem(label, true); } else { menuItem = new MenuItem(label); } menuItem.setActionCommand(command); menuItem.addActionListener(this); menuItem.setEnabled(command != null); ((Menu)targetMenu).add(menuItem); } }