Can you help me with one problem,
I dont know how to invoke action op menu not the menu item?
I have File and Help menus and I need to invoke action when the Help menu is pressed but dont understand how, I know how to do in on MenuItem but same thing does not work on menu?
// menu 2
menu2 = new JMenu("Help");
menu2.setMnemonic('H');
menuBar.add(menu2);
menu2.addActionListener(this);
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("Exit"))
{
System.exit(0);
}
else if (e.getSource() == menu2) {
JOptionPane.showMessageDialog(frame, "Protected Viewer\n Version 2.1\n January 15, 2011\n 218", "About Protected View", JOptionPane.INFORMATION_MESSAGE);
}
if i do this for menu item like Exit it works but in menu it does not work?