コード例 #1
0
 /**
  * This is the hook through which all menu items are created. It registers the result with the
  * menuitem hashtable so that it can be fetched with getMenuItem().
  *
  * @see #getMenuItem
  */
 protected JMenuItem createMenuItem(String cmd) {
   JMenuItem mi = new JMenuItem(getResourceString(cmd + labelSuffix));
   URL url = getResource(cmd + imageSuffix);
   if (url != null) {
     mi.setHorizontalTextPosition(JButton.RIGHT);
     mi.setIcon(new ImageIcon(url));
   }
   String astr = getResourceString(cmd + actionSuffix);
   if (astr == null) {
     astr = cmd;
   }
   mi.setActionCommand(astr);
   Action myaction = getAction(astr); // if this is a known action
   if (myaction != null) {
     mi.addActionListener(myaction);
     myaction.addPropertyChangeListener(createActionChangeListener(mi));
     // System.out.println("myaction not null: astr:"+astr+" enabled:"+myaction.isEnabled());
     mi.setEnabled(myaction.isEnabled());
   } else {
     System.err.println("Error:TextViewer: createMenuItem: myaction is null: astr:" + astr);
     // causes the item to be greyed out
     mi.setEnabled(false);
   }
   menuItems.put(cmd, mi);
   return mi;
 }
  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);
          }
        }
      }
    }
  }
コード例 #3
0
 @Override
 public void setProfiler(Profiler profiler) {
   if (profiler != null) {
     profilerWindow = new ProfilerWindow(profiler);
     profilerMenuItem.setEnabled(true);
   } else {
     profilerWindow = null;
     profilerMenuItem.setEnabled(false);
   }
 }
コード例 #4
0
ファイル: BasicFrame.java プロジェクト: benlakey/breakout
 protected void togglePause() {
   if (_appState == Constants.appStates.Paused) {
     _appState = Constants.appStates.Initialized;
     _menuGameGo.setEnabled(false);
     _menuGamePause.setEnabled(true);
   } else if (_appState == Constants.appStates.Initialized) {
     _appState = Constants.appStates.Paused;
     _menuGameGo.setEnabled(true);
     _menuGamePause.setEnabled(false);
   }
 }
コード例 #5
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
 // 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);
 }
コード例 #6
0
ファイル: JImage.java プロジェクト: RussTedrake/lcm
  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);
  }
コード例 #7
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
  // 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);
  }
コード例 #8
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
  // enable all menu items/menus for operations that require
  // a Gist to work on, excluding the debugging functions
  private void enableIndexOpened() {
    DbgOutput.println(1, "enableIndexOpened()");
    setAllEnabled(true);
    // debugging operations only during operations
    stepAction.setEnabled(false);
    stopAction.setEnabled(false);
    cancelAction.setEnabled(false);
    nextAction.setEnabled(false);
    contAction.setEnabled(false);

    // no profile opened
    completeAnalysisItem.setEnabled(false);
    wkldStatsItem.setEnabled(false);
    splitStatsItem.setEnabled(false);
    penaltyStatsItem.setEnabled(false);
  }
  public void adjustFinderMenuBar() {
    JMenuItem menuItem;
    Action act;
    String itemLabel;
    ICFSecurityServiceTypeObj selectedObj = getSwingFocusAsServiceType();
    boolean enableState;
    if (selectedObj == null) {
      enableState = false;
    } else {
      enableState = true;
    }

    if (actionViewSelected != null) {
      actionViewSelected.setEnabled(enableState);
    }
    if (actionEditSelected != null) {
      actionEditSelected.setEnabled(enableState);
    }
    if (actionDeleteSelected != null) {
      actionDeleteSelected.setEnabled(enableState);
    }
    if (actionAddServiceType != null) {
      actionAddServiceType.setEnabled(true);
    }

    if (menuFile != null) {
      int itemCount = menuFile.getItemCount();
      for (int itemIdx = 0; itemIdx < itemCount; itemIdx++) {
        menuItem = menuFile.getItem(itemIdx);
        act = menuItem.getAction();
        if (act != null) {
          if (act == actionViewSelected) {
            menuItem.setEnabled(enableState);
          } else if (act == actionEditSelected) {
            menuItem.setEnabled(enableState);
          } else if (act == actionDeleteSelected) {
            menuItem.setEnabled(enableState);
          } else if (act == actionAddServiceType) {
            menuItem.setEnabled(true);
          }
        }
      }
    }
  }
コード例 #10
0
ファイル: StartupUtil.java プロジェクト: DarkStorm652/DarkMod
 public void handleUI() {
   DarkMod darkMod = DarkMod.getInstance();
   DarkModUI ui = darkMod.getUI();
   JButton screenshotButton = ui.getScreenshotButton();
   screenshotButton.setEnabled(true);
   if (!darkMod.isPlayingOffline()) {
     JMenuItem newSessionIDItem = ui.getNewSessionIDItem();
     newSessionIDItem.setEnabled(true);
   }
 }
コード例 #11
0
ファイル: Notepad.java プロジェクト: ArcherSys/ArcherSysRuby
 public void propertyChange(PropertyChangeEvent e) {
   String propertyName = e.getPropertyName();
   if (e.getPropertyName().equals(Action.NAME)) {
     String text = (String) e.getNewValue();
     menuItem.setText(text);
   } else if (propertyName.equals("enabled")) {
     Boolean enabledState = (Boolean) e.getNewValue();
     menuItem.setEnabled(enabledState.booleanValue());
   }
 }
コード例 #12
0
 public void propertyChange(PropertyChangeEvent e) {
   String propertyName = e.getPropertyName();
   if (e.getPropertyName().equals(Action.NAME)) {
     String text = (String) e.getNewValue();
     menuItem.setText(text);
   } else if (propertyName.equals("enabled")) {
     // System.out.println("Debug:TextViewer: ActionChangedListener enabled");
     Boolean enabledState = (Boolean) e.getNewValue();
     menuItem.setEnabled(enabledState.booleanValue());
   }
 }
コード例 #13
0
 /** 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;
 }
コード例 #14
0
  /** 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;
  }
コード例 #15
0
  /**
   * Creates an instance of <tt>ChatRoomsListRightButtonMenu</tt>.
   *
   * @param chatRoomWrapper the chat room wrapper, corresponding to the selected chat room
   */
  public ChatRoomRightButtonMenu(ChatRoomWrapper chatRoomWrapper) {
    this.chatRoomWrapper = chatRoomWrapper;

    this.setLocation(getLocation());

    createMenuItem("service.gui.OPEN", ImageLoader.CHAT_ROOM_16x16_ICON, "openChatRoom");
    JMenuItem joinChatRoomItem =
        createMenuItem("service.gui.JOIN", ImageLoader.JOIN_ICON, "joinChatRoom");
    JMenuItem joinAsChatRoomItem =
        createMenuItem("service.gui.JOIN_AS", ImageLoader.JOIN_AS_ICON, "joinAsChatRoom");
    JMenuItem leaveChatRoomItem =
        createMenuItem("service.gui.LEAVE", ImageLoader.LEAVE_ICON, "leaveChatRoom");
    createMenuItem("service.gui.REMOVE", ImageLoader.DELETE_16x16_ICON, "removeChatRoom");

    ChatRoom chatRoom = chatRoomWrapper.getChatRoom();

    if ((chatRoom != null) && chatRoom.isJoined()) {
      joinAsChatRoomItem.setEnabled(false);
      joinChatRoomItem.setEnabled(false);
    } else leaveChatRoomItem.setEnabled(false);
  }
コード例 #16
0
  // Public Methods
  public void appendNextTreeGeneration(Vector generation) {
    DefaultMutableTreeNode nextGeneration = generationNodeBuilder(generation);

    generations.add(nextGeneration);

    // If Generations contains leaf nodes (generated objects)
    // Enabled Save All Menu Item
    if (generations.getLeafCount() > 0) miSaveAll.setEnabled(true);
    else miSaveAll.setEnabled(false);

    // Update JTree View

    // affected nodes needing updating
    int[] nodeRangeToUpdate = {generations.getIndex(nextGeneration)};
    ((DefaultTreeModel) tree.getModel()).nodesWereInserted(generations, nodeRangeToUpdate);

    // Expand Parent after first child node is displayed
    if (generationNumber == 1) tree.expandRow(0);

    ++generationNumber;
  }
コード例 #17
0
ファイル: ControlPanel.java プロジェクト: johnperry/Geneva2
    public Popup() {
      super();
      String[] profileNames = profiles.getNames();
      JMenuItem item;

      // Make the load menu
      JMenu loadMenu = new JMenu("Load profile");
      loadMenu.setEnabled(profiles.size() > 0);
      addProfiles(loadMenu, profileNames, profileLoader);
      this.add(loadMenu);
      this.addSeparator();

      // put in a dummy item
      item = new JMenuItem();
      item.setEnabled(false);
      this.add(item);
      this.addSeparator();

      // Make the save menu
      JMenu saveMenu = new JMenu("Save profile");
      item = new JMenuItem("New...");
      item.addActionListener(profileSaver);
      saveMenu.add(item);
      saveMenu.addSeparator();
      addProfiles(saveMenu, profileNames, profileSaver);
      this.add(saveMenu);
      this.addSeparator();

      // put in a dummy item
      item = new JMenuItem();
      item.setEnabled(false);
      this.add(item);
      this.addSeparator();

      // Make the delete menu
      JMenu deleteMenu = new JMenu("Delete profile");
      deleteMenu.setEnabled(profiles.size() > 0);
      addProfiles(deleteMenu, profileNames, profileDeleter);
      this.add(deleteMenu);
    }
コード例 #18
0
ファイル: BasicFrame.java プロジェクト: benlakey/breakout
  private void generateMenus() {

    _menuBar = new JMenuBar();

    JMenu menuFile = new JMenu("File");
    JMenu menuGame = new JMenu("Game");
    JMenu menuHelp = new JMenu("Help");

    menuFile.setMnemonic('f');
    menuGame.setMnemonic('g');
    menuHelp.setMnemonic('h');

    JMenuItem menuFileExit = new JMenuItem("Exit", 'x');
    JMenuItem menuFileNew = new JMenuItem("New", 'n');

    _menuGameGo = new JMenuItem("Go", 'g');
    _menuGamePause = new JMenuItem("Pause", 'p');
    _menuGamePause.setEnabled(false);

    JCheckBoxMenuItem menuGameZoomToggle = new JCheckBoxMenuItem("Zoom 2X", false);
    menuGameZoomToggle.setMnemonic('z');

    JMenuItem menuGameOptions = new JMenuItem("Options...", 'o');

    JMenuItem menuHelpAbout = new JMenuItem("About", 'a');

    menuFileExit.addActionListener(this);
    menuFileNew.addActionListener(this);

    _menuGameGo.addActionListener(this);
    _menuGamePause.addActionListener(this);
    menuGameZoomToggle.addActionListener(this);
    menuGameOptions.addActionListener(this);

    menuHelpAbout.addActionListener(this);

    menuFile.add(menuFileNew);
    menuFile.add(menuFileExit);

    menuGame.add(_menuGameGo);
    menuGame.add(_menuGamePause);
    menuGame.add(menuGameZoomToggle);
    menuGame.add(menuGameOptions);

    menuHelp.add(menuHelpAbout);

    _menuBar.add(menuFile);
    _menuBar.add(menuGame);
    _menuBar.add(menuHelp);

    setJMenuBar(_menuBar);
  }
コード例 #19
0
ファイル: Notepad.java プロジェクト: ArcherSys/ArcherSysRuby
 /** This is the hook through which all menu items are created. */
 protected JMenuItem createMenuItem(String cmd) {
   JMenuItem mi = new JMenuItem(getResourceString(cmd + labelSuffix));
   URL url = getResource(cmd + imageSuffix);
   if (url != null) {
     mi.setHorizontalTextPosition(JButton.RIGHT);
     mi.setIcon(new ImageIcon(url));
   }
   String astr = getProperty(cmd + actionSuffix);
   if (astr == null) {
     astr = cmd;
   }
   mi.setActionCommand(astr);
   Action a = getAction(astr);
   if (a != null) {
     mi.addActionListener(a);
     a.addPropertyChangeListener(createActionChangeListener(mi));
     mi.setEnabled(a.isEnabled());
   } else {
     mi.setEnabled(false);
   }
   return mi;
 }
コード例 #20
0
ファイル: TextPanel.java プロジェクト: dimitarp/basex
  /** Code completion. */
  private void complete() {
    if (selected()) return;

    // find first character
    final int caret = editor.pos(), startPos = editor.completionStart();
    final String prefix = string(substring(editor.text(), startPos, caret));
    if (prefix.isEmpty()) return;

    // find insertion candidates
    final TreeMap<String, String> tmp = new TreeMap<>();
    for (final Entry<String, String> entry : REPLACE.entrySet()) {
      final String key = entry.getKey();
      if (key.startsWith(prefix)) tmp.put(key, entry.getValue());
    }

    if (tmp.size() == 1) {
      // insert single candidate
      complete(tmp.values().iterator().next(), startPos);
    } else if (!tmp.isEmpty()) {
      // show popup menu
      final JPopupMenu pm = new JPopupMenu();
      final ActionListener al =
          new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent ae) {
              complete(ae.getActionCommand().replaceAll("^.*?\\] ", ""), startPos);
            }
          };

      for (final Entry<String, String> entry : tmp.entrySet()) {
        final JMenuItem mi = new JMenuItem("[" + entry.getKey() + "] " + entry.getValue());
        pm.add(mi);
        mi.addActionListener(al);
      }
      pm.addSeparator();
      final JMenuItem mi = new JMenuItem(Text.INPUT + Text.COLS + prefix);
      mi.setEnabled(false);
      pm.add(mi);

      final int[] cursor = rend.cursor();
      pm.show(this, cursor[0], cursor[1]);

      // highlight first entry
      final MenuElement[] me = {pm, (JMenuItem) pm.getComponent(0)};
      MenuSelectionManager.defaultManager().setSelectedPath(me);
    }
  }
コード例 #21
0
  public SwingWorkerFrame() {
    chooser = new JFileChooser();
    chooser.setCurrentDirectory(new File("."));

    textArea = new JTextArea(TEXT_ROWS, TEXT_COLUMNS);
    add(new JScrollPane(textArea));

    statusLine = new JLabel(" ");
    add(statusLine, BorderLayout.SOUTH);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu menu = new JMenu("File");
    menuBar.add(menu);

    openItem = new JMenuItem("Open");
    menu.add(openItem);
    openItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            // show file chooser dialog
            int result = chooser.showOpenDialog(null);

            // if file selected, set it as icon of the label
            if (result == JFileChooser.APPROVE_OPTION) {
              textArea.setText("");
              openItem.setEnabled(false);
              textReader = new TextReader(chooser.getSelectedFile());
              textReader.execute();
              cancelItem.setEnabled(true);
            }
          }
        });

    cancelItem = new JMenuItem("Cancel");
    menu.add(cancelItem);
    cancelItem.setEnabled(false);
    cancelItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            textReader.cancel(true);
          }
        });
    pack();
  }
コード例 #22
0
  private void buildMenu() {
    jMenuBar = new javax.swing.JMenuBar();
    mainMenu = new javax.swing.JMenu();
    mainMenu.setText("Main");

    loginMenuItem = new JMenuItem("Login...");
    loginMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            headerPanel.handleLoginLogout();
          }
        });

    mainMenu.add(loginMenuItem);

    exitMenuItem = new JMenuItem("Exit");
    exitMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            if (qsadminMain.isConnected() == true) {
              headerPanel.handleLoginLogout();
            }
            System.exit(0);
          }
        });
    mainMenu.add(exitMenuItem);

    helpMenu = new javax.swing.JMenu();
    helpMenu.setText("Help");

    aboutMenuItem = new JMenuItem("About...");
    aboutMenuItem.setEnabled(true);
    aboutMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            about();
          }
        });
    helpMenu.add(aboutMenuItem);

    jMenuBar.add(mainMenu);
    jMenuBar.add(helpMenu);

    parentFrame.setJMenuBar(jMenuBar);
  }
コード例 #23
0
ファイル: ConfigEditor.java プロジェクト: caomw/viper-toolkit
 public void show(Component invoker, int x, int y) {
   Object o = getTree().getClosestPathForLocation(x, y).getLastPathComponent();
   if (null != o) {
     node = (Node) o;
     if ((node instanceof AttrConfig) || (node instanceof Config)) {
       newAttribute.setEnabled(true);
       duplicate.setEnabled(true);
       delete.setEnabled(true);
     } else {
       newAttribute.setEnabled(false);
       duplicate.setEnabled(false);
       delete.setEnabled(false);
     }
     super.show(invoker, x, y);
   }
 }
コード例 #24
0
 public void updateLanguage() {
   //////////////////////////////////////////////////////////////
   mdic = MonitorDictionary.getChildDictionary("ThreadManager");
   MonitorDictionary.applyButton(btnKick, "Kick");
   MonitorDictionary.applyButton(btnRefresh, "Refresh");
   MonitorDictionary.applyButton(btnSend, "Send");
   tblUser.setColumnNameEx(mdic.getString("LoginName"), 1);
   tblUser.setColumnNameEx(mdic.getString("LoginTime"), 2);
   tblUser.setColumnNameEx(mdic.getString("Host"), 3);
   //////////////////////////////////////////////////////////////
   MonitorDictionary.applyButton(mnuSelectAll, "jmenu.Edit.SelectAll");
   MonitorDictionary.applyButton(mnuClearAll, "jmenu.Edit.ClearAll");
   MonitorDictionary.applyButton(mnuClearSelected, "jmenu.Edit.ClearSelected");
   //////////////////////////////////////////////////////////////
   MonitorDictionary.applyButton(mnuSystem, "jmenu.System");
   MonitorDictionary.applyButton(mnuSystem_ChangePassword, "jmenu.System.ChangePassword");
   MonitorDictionary.applyButton(mnuSystem_StopServer, "jmenu.System.Shutdown");
   MonitorDictionary.applyButton(mnuSystem_EnableThreads, "jmenu.System.ThreadManager");
   MonitorDictionary.applyButton(mnuHelp, "jmenu.Help");
   MonitorDictionary.applyButton(mnuHelp_About, "jmenu.Help.About");
   //////////////////////////////////////////////////////////////
   MonitorDictionary.applyButton(mnuUI, "jmenu.UI");
   //////////////////////////////////////////////////////////////
   if (isOpen()) {
     lblStatus.setText(
         "  " + MonitorDictionary.getString("LoggedUser") + ": " + channel.getUserName());
     MonitorDictionary.applyButton(mnuSystem_Login, "jmenu.System.Logout");
     mnuSystem_ChangePassword.setEnabled(true);
     mnuSystem_StopServer.setEnabled(true);
     mnuSystem_EnableThreads.setEnabled(true);
   } else {
     lblStatus.setText("");
     MonitorDictionary.applyButton(mnuSystem_Login, "jmenu.System.Login");
     mnuSystem_ChangePassword.setEnabled(false);
     mnuSystem_StopServer.setEnabled(false);
     mnuSystem_EnableThreads.setEnabled(false);
   }
   //////////////////////////////////////////////////////////////
   for (int iIndex = 0; iIndex < pnlThread.getTabCount(); iIndex++)
     ((PanelThreadMonitor) pnlThread.getComponentAt(iIndex)).updateLanguage();
 }
コード例 #25
0
  /** Adds the menu items to the menuber. */
  protected void arrangeMenu() {

    // Build the first menu.
    fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    viewMenu = new JMenu("View");
    viewMenu.setMnemonic(KeyEvent.VK_V);
    menuBar.add(viewMenu);

    runMenu = new JMenu("Run");
    runMenu.setMnemonic(KeyEvent.VK_R);
    menuBar.add(runMenu);

    // Build the second menu.
    helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    programMenuItem = new JMenuItem("Load Program", KeyEvent.VK_O);
    programMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            programMenuItem_actionPerformed();
          }
        });
    fileMenu.add(programMenuItem);

    scriptMenuItem = new JMenuItem("Load Script", KeyEvent.VK_P);
    scriptMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            scriptMenuItem_actionPerformed();
          }
        });
    fileMenu.add(scriptMenuItem);
    fileMenu.addSeparator();

    exitMenuItem = new JMenuItem("Exit", KeyEvent.VK_X);
    exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK));
    exitMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exitMenuItem_actionPerformed();
          }
        });
    fileMenu.add(exitMenuItem);

    viewMenu.addSeparator();

    ButtonGroup animationRadioButtons = new ButtonGroup();

    animationSubMenu = new JMenu("Animate");
    animationSubMenu.setMnemonic(KeyEvent.VK_A);
    viewMenu.add(animationSubMenu);

    partAnimMenuItem = new JRadioButtonMenuItem("Program flow");
    partAnimMenuItem.setMnemonic(KeyEvent.VK_P);
    partAnimMenuItem.setSelected(true);
    partAnimMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            partAnimMenuItem_actionPerformed();
          }
        });
    animationRadioButtons.add(partAnimMenuItem);
    animationSubMenu.add(partAnimMenuItem);

    fullAnimMenuItem = new JRadioButtonMenuItem("Program & data flow");
    fullAnimMenuItem.setMnemonic(KeyEvent.VK_D);
    fullAnimMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fullAnimMenuItem_actionPerformed();
          }
        });
    animationRadioButtons.add(fullAnimMenuItem);
    animationSubMenu.add(fullAnimMenuItem);

    noAnimMenuItem = new JRadioButtonMenuItem("No Animation");
    noAnimMenuItem.setMnemonic(KeyEvent.VK_N);
    noAnimMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            noAnimMenuItem_actionPerformed();
          }
        });
    animationRadioButtons.add(noAnimMenuItem);
    animationSubMenu.add(noAnimMenuItem);

    ButtonGroup additionalDisplayRadioButtons = new ButtonGroup();

    additionalDisplaySubMenu = new JMenu("View");
    additionalDisplaySubMenu.setMnemonic(KeyEvent.VK_V);
    viewMenu.add(additionalDisplaySubMenu);

    scriptDisplayMenuItem = new JRadioButtonMenuItem("Script");
    scriptDisplayMenuItem.setMnemonic(KeyEvent.VK_S);
    scriptDisplayMenuItem.setSelected(true);
    scriptDisplayMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            scriptDisplayMenuItem_actionPerformed();
          }
        });
    additionalDisplayRadioButtons.add(scriptDisplayMenuItem);
    additionalDisplaySubMenu.add(scriptDisplayMenuItem);

    outputMenuItem = new JRadioButtonMenuItem("Output");
    outputMenuItem.setMnemonic(KeyEvent.VK_O);
    outputMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            outputMenuItem_actionPerformed();
          }
        });
    additionalDisplayRadioButtons.add(outputMenuItem);
    additionalDisplaySubMenu.add(outputMenuItem);

    compareMenuItem = new JRadioButtonMenuItem("Compare");
    compareMenuItem.setMnemonic(KeyEvent.VK_C);
    compareMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            compareMenuItem_actionPerformed();
          }
        });
    additionalDisplayRadioButtons.add(compareMenuItem);
    additionalDisplaySubMenu.add(compareMenuItem);

    noAdditionalDisplayMenuItem = new JRadioButtonMenuItem("Screen");
    noAdditionalDisplayMenuItem.setMnemonic(KeyEvent.VK_N);
    noAdditionalDisplayMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            noAdditionalDisplayMenuItem_actionPerformed();
          }
        });
    additionalDisplayRadioButtons.add(noAdditionalDisplayMenuItem);
    additionalDisplaySubMenu.add(noAdditionalDisplayMenuItem);

    ButtonGroup formatRadioButtons = new ButtonGroup();

    numericFormatSubMenu = new JMenu("Format");
    numericFormatSubMenu.setMnemonic(KeyEvent.VK_F);
    viewMenu.add(numericFormatSubMenu);

    decMenuItem = new JRadioButtonMenuItem("Decimal");
    decMenuItem.setMnemonic(KeyEvent.VK_D);
    decMenuItem.setSelected(true);
    decMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            decMenuItem_actionPerformed();
          }
        });
    formatRadioButtons.add(decMenuItem);
    numericFormatSubMenu.add(decMenuItem);

    hexaMenuItem = new JRadioButtonMenuItem("Hexadecimal");
    hexaMenuItem.setMnemonic(KeyEvent.VK_H);
    hexaMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            hexaMenuItem_actionPerformed();
          }
        });
    formatRadioButtons.add(hexaMenuItem);
    numericFormatSubMenu.add(hexaMenuItem);

    binMenuItem = new JRadioButtonMenuItem("Binary");
    binMenuItem.setMnemonic(KeyEvent.VK_B);
    binMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            binMenuItem_actionPerformed();
          }
        });
    formatRadioButtons.add(binMenuItem);
    numericFormatSubMenu.add(binMenuItem);

    viewMenu.addSeparator();

    singleStepMenuItem = new JMenuItem("Single Step", KeyEvent.VK_S);
    singleStepMenuItem.setAccelerator(KeyStroke.getKeyStroke("F11"));
    singleStepMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepMenuItem_actionPerformed();
          }
        });
    runMenu.add(singleStepMenuItem);

    ffwdMenuItem = new JMenuItem("Run", KeyEvent.VK_F);
    ffwdMenuItem.setAccelerator(KeyStroke.getKeyStroke("F5"));
    ffwdMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdMenuItem_actionPerformed();
          }
        });
    runMenu.add(ffwdMenuItem);

    stopMenuItem = new JMenuItem("Stop", KeyEvent.VK_T);
    stopMenuItem.setAccelerator(KeyStroke.getKeyStroke("shift F5"));
    stopMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopMenuItem_actionPerformed();
          }
        });
    runMenu.add(stopMenuItem);

    rewindMenuItem = new JMenuItem("Reset", KeyEvent.VK_R);
    rewindMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindMenuItem_actionPerformed();
          }
        });
    runMenu.add(rewindMenuItem);

    runMenu.addSeparator();

    breakpointsMenuItem = new JMenuItem("Breakpoints", KeyEvent.VK_B);
    breakpointsMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            breakpointsMenuItem_actionPerformed();
          }
        });
    runMenu.add(breakpointsMenuItem);

    profilerMenuItem = new JMenuItem("Profiler", KeyEvent.VK_I);
    profilerMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            showProfiler();
          }
        });
    profilerMenuItem.setEnabled(false);
    runMenu.add(profilerMenuItem);

    usageMenuItem = new JMenuItem("Usage", KeyEvent.VK_U);
    usageMenuItem.setAccelerator(KeyStroke.getKeyStroke("F1"));
    usageMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            usageMenuItem_actionPerformed();
          }
        });
    helpMenu.add(usageMenuItem);

    aboutMenuItem = new JMenuItem("About ...", KeyEvent.VK_A);
    aboutMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            aboutMenuItem_actionPerformed();
          }
        });
    helpMenu.add(aboutMenuItem);
  }
コード例 #26
0
 /** Disables the rewind action. */
 public void disableRewind() {
   rewindButton.setEnabled(false);
   rewindMenuItem.setEnabled(false);
 }
コード例 #27
0
 /** Enables the rewind action. */
 public void enableRewind() {
   rewindButton.setEnabled(true);
   rewindMenuItem.setEnabled(true);
 }
コード例 #28
0
 /** Disables the eject action. */
 public void disableScript() {
   scriptButton.setEnabled(false);
   scriptMenuItem.setEnabled(false);
 }
コード例 #29
0
 /** Enables the eject action. */
 public void enableScript() {
   scriptButton.setEnabled(true);
   scriptMenuItem.setEnabled(true);
 }
コード例 #30
0
 /** Disables the stop action. */
 public void disableStop() {
   stopButton.setEnabled(false);
   stopMenuItem.setEnabled(false);
 }