JMenuItem viewSecondPage;
public TestMenuBar(ActionListener parent)
{
file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
printer = new JMenuItem("Print");
printer.setMnemonic(KeyEvent.VK_R);
printer.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R,
ActionEvent.CTRL_MASK));
printer.addActionListener(parent);
//printer.setEnabled(false);
file.add(printer);
close = new JMenuItem("Close");
close.setMnemonic(KeyEvent.VK_Q);
close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
ActionEvent.CTRL_MASK));
close.addActionListener(parent);
file.add(close);
view = new JMenu("View");
view.setMnemonic(KeyEvent.VK_V);
// This isn't very extensible
viewFirstPage = new JMenuItem("First Page");
viewFirstPage.addActionListener(parent);
view.add(viewFirstPage);
viewSecondPage = new JMenuItem("Second Page");
viewSecondPage.addActionListener(parent);
view.add(viewSecondPage);
help = new JMenu("Help");
help.setMnemonic(KeyEvent.VK_H);
helpTopics = new JMenuItem("Help Topics");
helpTopics.addActionListener(parent);
help.add(helpTopics);
about = new JMenu("About");
about.setMnemonic(KeyEvent.VK_A);
aboutApp = new JMenuItem("About");
aboutApp.addActionListener(parent);
about.add(aboutApp);