/** Create menus */
  private JMenuBar createMenus() {
    JMenuItem mi;
    // ***** create the menubar ****
    menuBar = new JMenuBar();

    // ***** create File menu
    fileMenu = (JMenu) menuBar.add(new JMenu("File"));
    fileMenu.setMnemonic('F');
    createMenuItem(fileMenu, "Print", 'P', "", new PrintAction(this));
    createMenuItem(fileMenu, "Close", 'C', "", new CloseAction(this));
    fileMenu.add(new JSeparator());
    createMenuItem(fileMenu, "Exit", 'E', "", new ExitAction());

    // ***** create laf switcher menu
    lafMenu = (JMenu) menuBar.add(new JMenu("Look & Feel"));
    lafMenu.setMnemonic('L');

    mi = createLafMenuItem(lafMenu, "Java Look & Feel", 'J', "", metal);
    mi.setSelected(true); // this is the default l&f
    metalMenuItem = mi;

    createLafMenuItem(lafMenu, "Macintosh Look & Feel", 'M', "", mac);

    createLafMenuItem(lafMenu, "Motif Look & Feel", 'F', "", motif);

    createLafMenuItem(lafMenu, "Windows Look & Feel", 'W', "", windows);

    // ***** create themes menu
    themesMenu = (JMenu) menuBar.add(new JMenu("Themes"));
    themesMenu.setMnemonic('T');

    mi = createThemesMenuItem(themesMenu, "Default", 'D', "", new DefaultMetalTheme());
    mi.setSelected(true); // This is the default theme

    createThemesMenuItem(themesMenu, "Aqua", 'A', "", new AquaTheme());

    createThemesMenuItem(themesMenu, "Charcoal", 'C', "", new CharcoalTheme());

    createThemesMenuItem(themesMenu, "High Contrast", 'H', "", new ContrastTheme());

    createThemesMenuItem(themesMenu, "Emerald", 'E', "", new EmeraldTheme());

    createThemesMenuItem(themesMenu, "Ruby", 'R', "", new RubyTheme());

    createThemesMenuItem(themesMenu, "Presentation", 'P', "", new DemoMetalTheme());

    createThemesMenuItem(themesMenu, "Sandstone", 'S', "", new KhakiMetalTheme());

    createThemesMenuItem(themesMenu, "Big High Contrast", 'I', "", new BigContrastMetalTheme());

    createThemesMenuItem(themesMenu, "Blue", 'B', "", new BlueTheme());

    createThemesMenuItem(themesMenu, "Cougaar", 'O', "", new CougaarTheme());

    createThemesMenuItem(
        themesMenu, "Cougaar Presentation", 'O', "", new CougaarPresentationTheme());

    return menuBar;
  }
 /** Stores the current L&F, and calls updateLookAndFeel, below */
 public void setLookAndFeel(String laf) {
   if (currentLookAndFeel != laf) {
     currentLookAndFeel = laf;
     themesMenu.setEnabled(laf == metal);
     updateLookAndFeel();
   }
 }
  /** Creates a JRadioButtonMenuItem for the Look and Feel menu */
  private JMenuItem createLafMenuItem(
      JMenu menu, String label, char mnemonic, String accessibleDescription, String laf) {
    JMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(label));
    lafMenuGroup.add(mi);
    mi.setMnemonic(mnemonic);
    mi.getAccessibleContext().setAccessibleDescription(accessibleDescription);
    mi.addActionListener(new ChangeLookAndFeelAction(this, laf));
    mi.setEnabled(isAvailableLookAndFeel(laf));

    return mi;
  }
 /** Creates a generic menu item */
 protected JMenuItem createMenuItem(
     JMenu menu, String label, char mnemonic, String accessibleDescription, Action action) {
   JMenuItem mi = (JMenuItem) menu.add(new JMenuItem(label));
   mi.setMnemonic(mnemonic);
   mi.getAccessibleContext().setAccessibleDescription(accessibleDescription);
   mi.addActionListener(action);
   if (action == null) {
     mi.setEnabled(false);
   }
   return mi;
 }
  /** Creates a JRadioButtonMenuItem for the Themes menu */
  private JMenuItem createThemesMenuItem(
      JMenu menu,
      String label,
      char mnemonic,
      String accessibleDescription,
      DefaultMetalTheme theme) {
    JRadioButtonMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(label));
    themesMenuGroup.add(mi);
    mi.setMnemonic(mnemonic);
    mi.getAccessibleContext().setAccessibleDescription(accessibleDescription);
    mi.addActionListener(new ChangeThemeAction(this, theme));

    return mi;
  }
 /**
  * Set pluggable look and feel capable
  *
  * @param plaf true if all components of frame will support pluggable look and feel
  */
 public void setPlaf(boolean plaf) {
   lafMenu.setEnabled(plaf);
 }