Ejemplo n.º 1
0
  /** Create the menus that are used by this frame. */
  protected void _addMenus() {
    super._addMenus();

    _viewMenu.addSeparator();
    GUIUtilities.addHotKey(_getRightComponent(), _fullScreenAction);
    GUIUtilities.addMenuItem(_viewMenu, _fullScreenAction);
  }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
  /**
   * Initialize the given toolbar. Image icons will be obtained from the ApplicationResources object
   * and added to the actions. Note that the image icons are not added to the actions -- if we did
   * that, the icons would appear in the menus, which I suppose is a neat trick but completely
   * useless.
   */
  public void initializeToolBar(JToolBar tb) {
    Action action;
    RelativeBundle resources = getResources();

    // Conventional new/open/save buttons
    action = getAction("New");
    GUIUtilities.addToolBarButton(tb, action, null, resources.getImageIcon("NewImage"));

    action = getAction("Open");
    GUIUtilities.addToolBarButton(tb, action, null, resources.getImageIcon("OpenImage"));

    action = getAction("Save");
    GUIUtilities.addToolBarButton(tb, action, null, resources.getImageIcon("SaveImage"));
  }
Ejemplo n.º 4
0
    /**
     * Construct a full screen action.
     *
     * @param description A string that describes the action. Spaces are permitted, each word is
     *     usually capitalized.
     */
    public FullScreenAction(String description) {
      super(description);

      // Load the image by using the absolute path to the gif.
      // Using a relative location should work, but it does not.
      // Use the resource locator of the class.
      // For more information, see
      // jdk1.3/docs/guide/resources/resources.html
      GUIUtilities.addIcons(
          this,
          new String[][] {
            {"/ptolemy/vergil/basic/img/fullscreen.gif", GUIUtilities.LARGE_ICON},
            {"/ptolemy/vergil/basic/img/fullscreen_o.gif", GUIUtilities.ROLLOVER_ICON},
            {"/ptolemy/vergil/basic/img/fullscreen_ov.gif", GUIUtilities.ROLLOVER_SELECTED_ICON},
            {"/ptolemy/vergil/basic/img/fullscreen_on.gif", GUIUtilities.SELECTED_ICON}
          });

      putValue("tooltip", description);

      putValue(GUIUtilities.MNEMONIC_KEY, Integer.valueOf(KeyEvent.VK_S));
    }
Ejemplo n.º 5
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);
  }
Ejemplo n.º 6
0
 /** Show an error in a dialog box with stack trace. */
 public void showError(String op, Exception e) {
   GUIUtilities.showStackTrace(
       getAppContext().makeComponent(), e, "Please submit a bug report.\n\n" + op);
 }
Ejemplo n.º 7
0
 /**
  * Add an action to the toolbar. If the tool tip is null, use the "tooltip" property already in
  * the action, otherwise add the property to the action. The new button is added to the action as
  * the "toolButton" property.
  *
  * @deprecated Use method in GUIUtilities instead.
  */
 public JButton addToolBarButton(
     JToolBar toolbar, Action action, String tooltip, Icon icon, boolean isEnabled) {
   return GUIUtilities.addToolBarButton(toolbar, action, tooltip, icon, isEnabled);
 }
Ejemplo n.º 8
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);
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
0
 /**
  * Initialize this class. In this base class, a button for the full screen action is added to the
  * toolbar.
  */
 protected void _initExtendedGraphFrame() {
   GUIUtilities.addToolBarButton(_toolbar, _fullScreenAction);
 }