コード例 #1
0
 /**
  * Create the menus that are used by this frame. It is essential that _createGraphPane() be called
  * before this.
  */
 protected void _addMenus() {
   super._addMenus();
   _caseMenu = new JMenu("Case");
   _caseMenu.setMnemonic(KeyEvent.VK_C);
   _menubar.add(_caseMenu);
   GUIUtilities.addHotKey(_getRightComponent(), _addCaseAction);
   GUIUtilities.addMenuItem(_caseMenu, _addCaseAction);
   GUIUtilities.addHotKey(_getRightComponent(), _removeCaseAction);
   GUIUtilities.addMenuItem(_caseMenu, _removeCaseAction);
 }
コード例 #2
0
ファイル: ExtendedGraphFrame.java プロジェクト: ptII/ptII
  /** Create the menus that are used by this frame. */
  protected void _addMenus() {
    super._addMenus();

    _viewMenu.addSeparator();
    GUIUtilities.addHotKey(_getRightComponent(), _fullScreenAction);
    GUIUtilities.addMenuItem(_viewMenu, _fullScreenAction);
  }
コード例 #3
0
  /** Initialize the menu bar */
  public void initializeMenuBar(JMenuBar menuBar) {
    Action action;
    JMenuItem item;

    // Create the File menu
    JMenu menuFile = new JMenu("File");
    menuFile.setMnemonic('F');
    menuBar.add(menuFile);

    action = DefaultActions.newAction(this);
    addAction(action);
    GUIUtilities.addMenuItem(menuFile, action, 'N', "Create a new graph document");

    action = DefaultActions.openAction(this);
    addAction(action);
    GUIUtilities.addMenuItem(menuFile, action, 'O', "Open a graph document");

    action = DefaultActions.closeAction(this);
    addAction(action);
    GUIUtilities.addMenuItem(menuFile, action, 'C', "Close the current graph document");

    menuFile.addSeparator();

    action = DefaultActions.saveAction(this);
    addAction(action);
    GUIUtilities.addMenuItem(menuFile, action, 'S', "Save the current graph document");

    action = DefaultActions.saveAsAction(this);
    addAction(action);
    GUIUtilities.addMenuItem(
        menuFile, action, 'A', "Save the current graph document to a different file");

    menuFile.addSeparator();

    action = DefaultActions.exitAction(this);
    addAction(action);
    GUIUtilities.addMenuItem(menuFile, action, 'X', "Exit from the graph editor");
    // Hook the exit action into the frame's close button, if we are
    // running in an ApplicationContext.
    getAppContext().setExitAction(action);
  }
コード例 #4
0
 /**
  * Add an action to a menu and return the menu item created. If the tool tip is null, use the
  * "tooltip" property already in the action, otherwise add the property to the action. (The
  * mnemonic isn't added.) The new menu item is added to the action as the "menuItem" property. The
  * menu item's text is set to be "label", and is disabled or enabled according to "isEnabled."
  *
  * @deprecated Use method in GUIUtilities instead.
  */
 public JMenuItem addMenuItem(
     JMenu menu, String label, Action action, int mnemonic, String tooltip, boolean isEnabled) {
   return GUIUtilities.addMenuItem(menu, label, action, mnemonic, tooltip, isEnabled);
 }
コード例 #5
0
 /**
  * Add an action to a menu and return the menu item created. If the tool tip is null, use the
  * "tooltip" property already in the action, otherwise add the property to the action. (The
  * mnemonic isn't added.) The new menu item is added to the action as the "menuItem" property. The
  * menu item's text is set using the action's name and is enabled by default.
  *
  * @deprecated Use method in GUIUtilities instead.
  */
 public JMenuItem addMenuItem(JMenu menu, Action action, int mnemonic, String tooltip) {
   return GUIUtilities.addMenuItem(menu, action, mnemonic, tooltip);
 }