Menubar Integration
public class MyMenuBar extends JMenuBar {
JMenu actionMenu;
JMenu viewMenu;
JMenu helpMenu;
public MyMenuBar() {
JMenuItem mi;
MyActionsListener actionListener = new MyActionsListener(...);
actionMenu = new JMenu("Action");
actionMenu.add(mi = new JMenuItem("Action Item 1"));
mi.setActionCommand("action1");
mi.addActionListener(actionListener);
actionMenu.add(mi = new JMenuItem("Action Item 2"));
mi.setActionCommand("action2");
mi.addActionListener(actionListener);
...
actionMenu.setActionCommand(VMenuID.ACTION);
add(actionMenu);
...
viewMenu = new JMenu("View");
viewMenu.add(mi = new JMenuItem("View Item 1"));
mi.setActionCommand("view1");
mi.addActionListener(actionListener);
viewMenu.add(mi = new JMenuItem("View Item 2"));
mi.setActionCommand("view2");
mi.addActionListener(actionListener);
...
viewMenu.setActionCommand(VMenuID.VIEW);
add(viewMenu);
...
helpMenu = new JMenu("Help");
helpMenu.add(mi = new JMenuItem("About My Tool"));
mi.setActionCommand("about");
mi.addActionListener(actionListener);
...
helpMenu.setActionCommand(VMenuID.HELP);
add(helpMenu);
...
}
}