Beispiel #1
0
  /* constructor
   * Create a frame with JTextArea and a menubar
   * with a "File" dropdown menu.
   *
   * @param title: the title for the frame
   * @param whichFile: to indicate which load or save buuton
   */
  public OpenFileDir(String title, String whichFile) {
    super(title);
    fileNo = whichFile;
    Container content_pane = getContentPane();

    // Create a user interface.
    content_pane.setLayout(new BorderLayout());

    // Use the helper method makeMenuItem
    // for making the menu items and registering
    // their listener.
    JMenu m = new JMenu("File");

    // Modify task names to something relevant to
    // the particular program.
    m.add(fMenuLoad = makeMenuItem("Load"));
    m.add(fMenuSave = makeMenuItem("Save"));
    m.add(fMenuClose = makeMenuItem("Quit"));

    JMenuBar mb = new JMenuBar();
    mb.add(m);

    setJMenuBar(mb);
    setSize(400, 200);
  } /* end of the constructor */
Beispiel #2
0
  @Override
  public JPopupMenu getComponentPopupMenu() {
    if (popupMenu == null) {
      popupMenu = new JPopupMenu(Messages.CHART_COLON);
      timeRangeMenu = new JMenu(Messages.PLOTTER_TIME_RANGE_MENU);
      timeRangeMenu.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_TIME_RANGE_MENU));
      popupMenu.add(timeRangeMenu);
      menuRBs = new JRadioButtonMenuItem[rangeNames.length];
      ButtonGroup rbGroup = new ButtonGroup();
      for (int i = 0; i < rangeNames.length; i++) {
        menuRBs[i] = new JRadioButtonMenuItem(rangeNames[i]);
        rbGroup.add(menuRBs[i]);
        menuRBs[i].addActionListener(this);
        if (viewRange == rangeValues[i]) {
          menuRBs[i].setSelected(true);
        }
        timeRangeMenu.add(menuRBs[i]);
      }

      popupMenu.addSeparator();

      saveAsMI = new JMenuItem(Messages.PLOTTER_SAVE_AS_MENU_ITEM);
      saveAsMI.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_SAVE_AS_MENU_ITEM));
      saveAsMI.addActionListener(this);
      popupMenu.add(saveAsMI);
    }
    return popupMenu;
  }
  public void adjustListMenuBar() {
    JMenuItem menuItem;
    Action act;
    String itemLabel;
    boolean enableState;
    boolean inEditState;
    boolean allowAdds;
    ICFInternetTopProjectObj selectedObj = getSwingFocusAsTopProject();
    CFJPanel.PanelMode mode = getPanelMode();
    if (mode == CFJPanel.PanelMode.Edit) {
      inEditState = true;
      if (getSwingContainer() != null) {
        allowAdds = true;
      } else {
        allowAdds = false;
      }
    } else {
      inEditState = false;
      allowAdds = false;
    }
    if (selectedObj == null) {
      enableState = false;
    } else {
      enableState = true;
    }

    if (actionViewSelected != null) {
      actionViewSelected.setEnabled(enableState);
    }
    if (actionEditSelected != null) {
      actionEditSelected.setEnabled(inEditState && enableState);
    }
    if (actionDeleteSelected != null) {
      actionDeleteSelected.setEnabled(inEditState && enableState);
    }
    if (actionAddTopProject != null) {
      actionAddTopProject.setEnabled(allowAdds);
    }

    if (menuAdd != null) {
      menuAdd.setEnabled(allowAdds);
    }
    if (menuSelected != null) {
      menuSelected.setEnabled(enableState);
      int itemCount = menuSelected.getItemCount();
      for (int itemIdx = 0; itemIdx < itemCount; itemIdx++) {
        menuItem = menuSelected.getItem(itemIdx);
        act = menuItem.getAction();
        if (act != null) {
          if (act == actionViewSelected) {
            menuItem.setEnabled(enableState);
          } else if (act == actionEditSelected) {
            menuItem.setEnabled(inEditState && enableState);
          } else if (act == actionDeleteSelected) {
            menuItem.setEnabled(inEditState && enableState);
          }
        }
      }
    }
  }
Beispiel #4
0
 private void createTreeStatsMenu() {
   treeStatsMenu = new JMenu("Tree Stats");
   menuBar.add(treeStatsMenu);
   utilItem = new JMenuItem("Utilization");
   treeStatsMenu.add(utilItem);
   utilItem.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           Libgist.getWkldNodeStats(Libgist.NODEUTIL, 0, false);
           treeView.showStats(Libgist.nodeCnt, Libgist.displayStats, utilItem.getText());
         }
       });
   slotCntItem = new JMenuItem("Slot Count");
   treeStatsMenu.add(slotCntItem);
   slotCntItem.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           Libgist.getWkldNodeStats(Libgist.SLOTCNT, 0, false);
           treeView.showStats(Libgist.nodeCnt, Libgist.displayStats, slotCntItem.getText());
         }
       });
   predSzItem = new JMenuItem("Predicate Size");
   treeStatsMenu.add(predSzItem);
   predSzItem.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           Libgist.getWkldNodeStats(Libgist.PREDSIZE, 0, false);
           treeView.showStats(Libgist.nodeCnt, Libgist.displayStats, predSzItem.getText());
         }
       });
 }
  private void addMenuItems(JMenu f, String m[]) {

    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

    for (int i = 0; i < m.length; i++) {
      if (m[i].equals("--")) {
        f.addSeparator();
      } else if (m[i].equals("---")) {

        // (ulrivo): full size on screen with less than 640 width
        if (d.width >= 640) {
          f.addSeparator();
        } else {
          return;
        }
      } else {
        JMenuItem item = new JMenuItem(m[i].substring(1));
        char c = m[i].charAt(0);

        if (c != '-') {
          item.setMnemonic(c);
        }

        item.addActionListener(this);
        f.add(item);
      }
    }
  }
  private void addToRecent(String s) {

    for (int i = 0; i < iMaxRecent; i++) {
      if (s.equals(sRecent[i])) {
        return;
      }
    }

    if (sRecent[iRecent] != null) {
      mRecent.remove(iRecent);
    }

    sRecent[iRecent] = s;

    if (s.length() > 43) {
      s = s.substring(0, 40) + "...";
    }

    JMenuItem item = new JMenuItem(s);

    item.setActionCommand("#" + iRecent);
    item.addActionListener(this);
    mRecent.insert(item, iRecent);

    iRecent = (iRecent + 1) % iMaxRecent;
  }
  protected JMenu makeFileMenu() {
    JMenu fileMenu = new JMenu("File");

    fileMenu.add(
        new AbstractAction("Open/Count") {
          public void actionPerformed(ActionEvent ev) {
            doRead();
          }
        });

    fileMenu.add(
        new AbstractAction("Compress") {
          public void actionPerformed(ActionEvent ev) {
            doSave();
          }
        });

    fileMenu.add(
        new AbstractAction("Uncompress") {
          public void actionPerformed(ActionEvent ev) {
            doDecode();
          }
        });

    fileMenu.add(
        new AbstractAction("Quit") {
          public void actionPerformed(ActionEvent ev) {
            System.exit(0);
          }
        });
    return fileMenu;
  }
Beispiel #8
0
  private void enableAnalysis() {
    setAllEnabled(false);
    analysisMenu.setEnabled(true);

    // get info on state of analysis
    String scriptFile;
    Libgist.getAnalysisInfo(analysisInfo);

    // newAnalysisItem not enabled: can't create new profile, we just closed the index
    newAnalysisItem.setEnabled(false);
    openAnalysisItem.setEnabled(true);
    completeAnalysisItem.setEnabled(true);

    wkldStatsItem.setEnabled(analysisInfo.actualHasWkldStats);
    splitStatsItem.setEnabled(analysisInfo.actualHasSplitStats);
    penaltyStatsItem.setEnabled(analysisInfo.actualHasPenaltyStats);

    // general tree statistics are okay
    treeStatsMenu.setEnabled(true);
    utilItem.setEnabled(true);
    predSzItem.setEnabled(true);
    slotCntItem.setEnabled(true);

    // can always select another index or exit
    fileMenu.setEnabled(true);
    newItem.setEnabled(true);
    openItem.setEnabled(true);
    exitItem.setEnabled(true);
  }
Beispiel #9
0
  void initControls() {
    JMenuItem jmi;

    jmi = new JMenuItem("JImage Menu");
    jmi.setEnabled(false);
    popupMenu.add(jmi);

    jmi = new JMenuItem("Fit");
    jmi.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fit = true;
            repaint();
          }
        });
    popupMenu.add(jmi);

    JMenu scaleMenu = new JMenu("Set Scale");
    popupMenu.add(scaleMenu);
    int scales[] = new int[] {25, 50, 100, 200, 400, 800};

    for (int i = 0; i < scales.length; i++) {
      jmi = new JMenuItem(scales[i] + " %");
      jmi.addActionListener(new ScaleAction(scales[i]));
      scaleMenu.add(jmi);
    }

    MyListener l = new MyListener();
    addMouseMotionListener(l);
    addMouseListener(l);
    addMouseWheelListener(l);
    addKeyListener(l);
  }
 public JMenuBar getPanelMenuBar() {
   if (panelMenuBar == null) {
     JMenuItem menuItem;
     ICFLibAnyObj container = getSwingContainer();
     panelMenuBar = new JMenuBar();
     menuAdd = new JMenu("Add");
     actionAddSecGroupMember = new ActionAddSecGroupMember();
     if (container instanceof ICFSecuritySecGroupObj) {
       menuItem = new JMenuItem(actionAddSecGroupMember);
       menuAdd.add(menuItem);
     }
     if (getSwingContainer() != null) {
       panelMenuBar.add(menuAdd);
     }
     menuSelected = new JMenu("Selected");
     menuSelected.setEnabled(false);
     actionViewSelected = new ViewSelectedActionSecGroupMember();
     menuItem = new JMenuItem(actionViewSelected);
     menuSelected.add(menuItem);
     actionEditSelected = new EditSelectedActionSecGroupMember();
     menuItem = new JMenuItem(actionEditSelected);
     menuSelected.add(menuItem);
     actionDeleteSelected = new DeleteSelectedActionSecGroupMember();
     menuItem = new JMenuItem(actionDeleteSelected);
     menuSelected.add(menuItem);
     panelMenuBar.add(menuSelected);
   }
   return (panelMenuBar);
 }
 public JMenuBar getPanelMenuBar() {
   if (panelMenuBar == null) {
     JMenuItem menuItem;
     ICFLibAnyObj container = getSwingContainer();
     panelMenuBar = new JMenuBar();
     menuAdd = new JMenu("Add");
     actionAddTopProject = new ActionAddTopProject();
     if (container instanceof ICFInternetDomainBaseObj) {
       menuItem = new JMenuItem(actionAddTopProject);
       menuAdd.add(menuItem);
     }
     if (getSwingContainer() != null) {
       panelMenuBar.add(menuAdd);
     }
     menuSelected = new JMenu("Selected");
     menuSelected.setEnabled(false);
     actionViewSelected = new ViewSelectedActionTopProject();
     menuItem = new JMenuItem(actionViewSelected);
     menuSelected.add(menuItem);
     actionEditSelected = new EditSelectedActionTopProject();
     menuItem = new JMenuItem(actionEditSelected);
     menuSelected.add(menuItem);
     actionDeleteSelected = new DeleteSelectedActionTopProject();
     menuItem = new JMenuItem(actionDeleteSelected);
     menuSelected.add(menuItem);
     panelMenuBar.add(menuSelected);
   }
   return (panelMenuBar);
 }
  public void initPopupMenu() {
    super.initPopupMenu();
    if (getPopupMenu() != null) {
      JMenu otherDataSourcesMenu = new JMenu("Other Data Sources");
      getPopupMenu().add(otherDataSourcesMenu);
      JMenuItem mi;
      mi = new JMenuItem("Show Level Lists");
      ShowLevelListAction showLevelList = new ShowLevelListAction("Show Level List");
      mi.setAction(showLevelList);
      getPopupMenu().add(mi);

      mi = new JMenuItem("Add Level Lists");
      AddLevelListAction addLevelList = new AddLevelListAction("Add Level List");
      mi.setAction(addLevelList);
      getPopupMenu().add(mi);

      mi = new JMenuItem("OMIM");
      mi.setActionCommand("goto OMIM");
      otherDataSourcesMenu.add(mi);
      mi = new JMenuItem("PubMed");
      mi.setActionCommand("goto PubMed");
      otherDataSourcesMenu.add(mi);
      mi = new JMenuItem("NCI Thesaurus");
      mi.setActionCommand("goto NCI Thesaurus Advice");
      otherDataSourcesMenu.add(mi);
      otherDataSourcesMenu.setOpaque(true);
      getPopupMenu().setOpaque(true);
      getPopupMenu().setLightWeightPopupEnabled(true);
    }
  }
  /** 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;
  }
Beispiel #14
0
 private JMenu addMenu(
     JMenuBar menuBar, String label, int mnemonic, String accessibleDescription) {
   JMenu menu = new JMenu(label);
   menu.setMnemonic(mnemonic);
   menu.getAccessibleContext().setAccessibleDescription(accessibleDescription);
   menuBar.add(menu);
   return menu;
 }
  public static JMenu getJMenu() {
    JMenu menu = new JMenu("copy to DeploymentDiagram as ComponentInstance");
    Project p = ProjectBrowser.TheInstance.getProject();
    for (Iterator it = p.getDiagrams().iterator(); it.hasNext(); ) {
      Object d = it.next();
      if (d instanceof UMLDeploymentDiagram) menu.add(new CopyAction((UMLDeploymentDiagram) d));
    }

    return menu;
  }
Beispiel #16
0
 /**
  * Create a menu for the app. By default this pulls the definition of the menu from the associated
  * resource file.
  */
 protected JMenu createMenu(String key) {
   JMenu menu = new JMenu(getResourceString(key + labelSuffix));
   for (String itemKey : getItemKeys(key)) {
     if (itemKey.equals("-")) {
       menu.addSeparator();
     } else {
       JMenuItem mi = createMenuItem(itemKey);
       menu.add(mi);
     }
   }
   return menu;
 }
 /**
  * This method initializes gameMenu
  *
  * @return JMenu
  */
 private JMenu getGameMenu() {
   if (gameMenu == null) {
     gameMenu = new JMenu();
     gameMenu.add(getJMenuItem());
     gameMenu.add(getJMenuItem3());
     gameMenu.add(getJMenuItem2());
     gameMenu.add(getJMenuItem1());
     gameMenu.setText("Game");
     gameMenu.setMnemonic(java.awt.event.KeyEvent.VK_G);
   }
   return gameMenu;
 }
  /*
   * Implements PopupMenuListener#popupMenuWillBecomeVisible(PopupMenuEvent).
   */
  public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
    createOtrContactMenus(currentContact);

    JMenu menu = getMenu();

    menu.addSeparator();

    whatsThis = new JMenuItem();
    whatsThis.setIcon(OtrActivator.resourceService.getImage("plugin.otr.HELP_ICON_15x15"));
    whatsThis.setText(OtrActivator.resourceService.getI18NString("plugin.otr.menu.WHATS_THIS"));
    whatsThis.addActionListener(this);
    menu.add(whatsThis);
  }
 /**
  * This method initializes jMenu
  *
  * @return JMenu
  */
 private JMenu getJMenu() {
   if (jMenu == null) {
     jMenu = new JMenu();
     jMenu.add(getJRadioButtonMenuItem());
     jMenu.add(getJRadioButtonMenuItem1());
     jMenu.setText("Theme");
     jMenu.setMnemonic(java.awt.event.KeyEvent.VK_T);
     ButtonGroup bg = new ButtonGroup();
     bg.add(getJRadioButtonMenuItem());
     bg.add(getJRadioButtonMenuItem1());
   }
   return jMenu;
 }
Beispiel #20
0
 // set all menu items related to debugging enabled, all else disabled;
 // for insert, remove and fetch: continue, step
 // additionally for scripts: next and sometimes cancel
 private void enableDebug(boolean isScript, boolean enableCancel) {
   setAllEnabled(false);
   debugMenu.setEnabled(true);
   stepAction.setEnabled(true);
   cancelAction.setEnabled(enableCancel);
   nextAction.setEnabled(isScript);
   contAction.setEnabled(true);
   breakpointsItem.setEnabled(true);
   treeStatsMenu.setEnabled(true);
   utilItem.setEnabled(true);
   predSzItem.setEnabled(true);
   slotCntItem.setEnabled(true);
 }
  private void addMenuToTray() {
    HashMap categories = new HashMap();

    // create menu list
    Iterator plugins = PluginManager.getInstance().getAvailablePlugins();
    plugins = PluginComparator.sortPlugins(plugins);

    while (plugins.hasNext()) {
      Plugin p = (Plugin) plugins.next();

      JMenu category = (JMenu) categories.get(p.getCategory());
      if (category == null) {
        category = new JMenu(p.getCategory());
        categories.put(p.getCategory(), category);

        // copy menu to real one
        if (!p.getCategory().equals("Invisible")) this.trayIcon.add(category);
      }

      ImageIcon icon = new ImageIcon();
      try {
        icon = new ImageIcon(new URL(p.getDirectory() + p.getIcon()));
        icon = new ImageIcon(icon.getImage().getScaledInstance(16, 16, Image.SCALE_SMOOTH));
      } catch (Exception e) {
        // error at icon loading
      }

      JMenuItem menu = new JMenuItem(p.getTitle(), icon);
      menu.setName(p.getName());
      menu.setToolTipText(p.getToolTip());
      menu.addActionListener(this);
      category.add(menu);
    }

    this.trayIcon.addSeparator();

    // windows
    this.trayIcon.add(new WindowMenu(this));

    // open main interface
    JMenuItem menu = new JMenuItem(tr("open"));
    menu.setName("org.lucane.applications.maininterface");
    menu.addActionListener(this);
    this.trayIcon.add(menu);

    // exit
    menu = new JMenuItem(tr("exit"));
    menu.setName("exit");
    menu.addActionListener(this);
    this.trayIcon.add(menu);
  }
Beispiel #22
0
  /*
   * Creates the JMenuBar for the GUI.
   */
  private JMenuBar menuBar() {
    menuBar = new JMenuBar();
    menu = new JMenu("Menu");
    load = new JMenuItem("Load...");
    saveAs = new JMenuItem("Save As...");
    load.addActionListener(new ActionListenerLoad());
    saveAs.addActionListener(new ActionListenerSave());

    // responseArea.addActionListener(new ActionListenerArea());
    menu.add(load);
    menu.add(saveAs);
    menuBar.add(menu);
    return menuBar;
  }
Beispiel #23
0
 /**
  * Create a menu for the app. By default this pulls the definition of the menu from the associated
  * resource file.
  */
 protected JMenu createMenu(String key) {
   String[] itemKeys = SCSUtility.tokenize(getResourceString(key));
   JMenu menu = new JMenu(getResourceString(key + "Label"));
   for (int i = 0; i < itemKeys.length; i++) {
     if (itemKeys[i].equals("-")) {
       menu.addSeparator();
     } else {
       // System.out.println("Debug:TextViewer:itemkey: "+itemKeys[i]);
       JMenuItem mi = createMenuItem(itemKeys[i]);
       menu.add(mi);
     }
   }
   return menu;
 }
  /**
   * Gets the <tt>JMenu</tt> which is the component of this plug-in. If it still doesn't exist, it's
   * created.
   *
   * @return the <tt>JMenu</tt> which is the component of this plug-in
   */
  private JMenu getMenu() {
    if (menu == null) {
      menu = new SIPCommMenu();
      menu.setText(getName());

      if (Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU.equals(getContainer())) {
        Icon icon = OtrActivator.resourceService.getImage("plugin.otr.MENU_ITEM_ICON_16x16");

        if (icon != null) menu.setIcon(icon);
      }

      if (!inMacOSXScreenMenuBar) menu.getPopupMenu().addPopupMenuListener(this);
    }
    return menu;
  }
Beispiel #25
0
  private void createJMenuBar() {
    menubar = new JMenuBar();
    JMenu menu = null;
    JMenuItem item = null;

    menubar.add(menu = new JMenu("Edit"));
    menu.add(item = new JMenuItem("Edit Object..."));

    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            browser.editSelected();
          }
        });
  }
Beispiel #26
0
  // enable startup menu items that don't require an index or profile to work with
  private void enableInit() {
    setAllEnabled(false);

    // we can create and open indices
    fileMenu.setEnabled(true);
    newItem.setEnabled(true);
    openItem.setEnabled(true);

    // we can execute scripts
    opsMenu.setEnabled(true);
    executeItem.setEnabled(true);

    // we can open profile
    analysisMenu.setEnabled(true);
    openAnalysisItem.setEnabled(true);
  }
Beispiel #27
0
 private void addProfiles(JMenu menu, String[] profileNames, ActionListener listener) {
   for (int i = 0; i < profileNames.length; i++) {
     JMenuItem item = new JMenuItem(profileNames[i]);
     item.addActionListener(listener);
     menu.add(item);
   }
 }
Beispiel #28
0
  public void populateMenu(JMenu menu, int flags) {
    if (flags == (Plugin.MENU_TOOLS | Plugin.MENU_MID)) {
      Sketch sketch = editor.getSketch();
      JMenuItem item = new JMenu("Program Bootloader");
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              run();
            }
          });
      menu.add(item);

      PropertyFile props = sketch.mergeAllProperties();
      String blProgs = props.get("bootloader.upload");
      if (blProgs == null) {
        JMenuItem sub = new JMenuItem("No bootloader programmer defined!");
        item.add(sub);
        return;
      }
      String[] progs = blProgs.split("::");
      for (String prog : progs) {
        JMenuItem sub = new JMenuItem(sketch.parseString(props.get("upload." + prog + ".name")));
        sub.setActionCommand(prog);
        sub.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                doProgram(e.getActionCommand());
              }
            });
        item.add(sub);
      }
    }
  }
  public void go() {
    frame = new JFrame("Quiz Card Player");
    JPanel mainPanel = new JPanel();
    Font bigFont = new Font("sanserif", Font.BOLD, 24);

    display = new JTextArea(10, 20);
    display.setFont(bigFont);
    display.setLineWrap(true);
    display.setEditable(false);

    JScrollPane qScroller = new JScrollPane(display);
    qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    nextButton = new JButton("Show Questions");
    nextButton.addActionListener(new NextCardListener());

    mainPanel.add(qScroller);
    mainPanel.add(nextButton);

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem loadMenuItem = new JMenuItem("Load Card Set");
    loadMenuItem.addActionListener(new OpenMenuListener());
    fileMenu.add(loadMenuItem);
    menuBar.add(fileMenu);

    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
    frame.setSize(640, 500);
    frame.setVisible(true);
  }
  public void go() {
    // build gui

    frame = new JFrame("Quiz Card Buider");
    JPanel mainPanel = new JPanel();
    Font bigFont = new Font("sanserif", Font.BOLD, 24);
    question = new JTextArea(6, 20);
    question.setLineWrap(true);
    question.setWrapStyleWord(true);
    question.setFont(bigFont);

    JScrollPane qScroller = new JScrollPane(question);
    qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    answer = new JTextArea(6, 20);
    answer.setLineWrap(true);
    answer.setWrapStyleWord(true);
    answer.setFont(bigFont);

    JScrollPane aScroller = new JScrollPane(question);
    aScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    aScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    JButton nextButton = new JButton("Next Card");

    cardList = new ArrayList<QuizCard>();

    JLabel qLabel = new JLabel("Question");
    JLabel aLabel = new JLabel("Answer");

    mainPanel.add(qLabel);
    mainPanel.add(qScroller);
    mainPanel.add(aLabel);
    mainPanel.add(aScroller);
    mainPanel.add(nextButton);

    nextButton.addActionListener(new NextCardListener());

    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");

    JMenuItem newMenuItem = new JMenuItem("New");
    JMenuItem saveMenuItem = new JMenuItem("Save");
    newMenuItem.addActionListener(new NewMenuListener());
    saveMenuItem.addActionListener(new SaveMenuListener());

    fileMenu.add(newMenuItem);
    fileMenu.add(saveMenuItem);
    menuBar.add(fileMenu);
    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
    frame.setSize(500, 600);
    frame.setVisible(true);
    // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  }