/**
   * Aware-P Epanet application entry point
   *
   * @param args
   * @throws UnsupportedLookAndFeelException
   */
  public static void main(String[] args) throws UnsupportedLookAndFeelException {
    if (Utilities.isMac()) {
      System.setProperty("apple.laf.useScreenMenuBar", "true");
      System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Aware-P Epanet");

      Application app = Application.getApplication();
      app.setDockIconImage(
          Toolkit.getDefaultToolkit().getImage(EpanetUI.class.getResource("/uiresources/ae.png")));

      JMenuBar menuBar = new JMenuBar();
      JMenu fileMenu = new JMenu("File");
      menuBar.add(fileMenu);

      openAction = new JMenuItem("Open");
      saveAction = new JMenuItem("Save");
      runAction = new JMenuItem("Run");

      fileMenu.add(openAction);
      fileMenu.add(saveAction);
      fileMenu.add(runAction);
      app.setDefaultMenuBar(menuBar);
    }
    UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    new EpanetUI();
  }
Exemple #2
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());
         }
       });
 }
Exemple #3
0
    public DemoControls(Gradient demo) {
      super(demo.name);
      this.demo = demo;
      JMenuBar inMenuBar = new JMenuBar();
      add(inMenuBar);
      JMenuBar outMenuBar = new JMenuBar();
      add(outMenuBar);
      Font font = new Font("serif", Font.PLAIN, 10);

      imenu = (JMenu) inMenuBar.add(new JMenu("Inner Color"));
      imenu.setFont(font);
      imenu.setIcon(new ColoredSquare(demo.innerC));
      omenu = (JMenu) outMenuBar.add(new JMenu("Outer Color"));
      omenu.setFont(font);
      omenu.setIcon(new ColoredSquare(demo.outerC));
      for (int i = 0; i < colors.length; i++) {
        squares[i] = new ColoredSquare(colors[i]);
        innerMI[i] = imenu.add(new JMenuItem(colorName[i]));
        innerMI[i].setFont(font);
        innerMI[i].setIcon(squares[i]);
        innerMI[i].addActionListener(this);
        outerMI[i] = omenu.add(new JMenuItem(colorName[i]));
        outerMI[i].setFont(font);
        outerMI[i].setIcon(squares[i]);
        outerMI[i].addActionListener(this);
      }
    }
  public void createMenu() {
    // Creates file menu and items
    JMenu fileMenu = new JMenu(messages.getString("GUIRendWorkspace.file"));
    fileMenu.setMnemonic('F');
    JMenuItem newItem = new JMenuItem(messages.getString("GUIRendWorkspace.fileNew"));
    newItem.setMnemonic('N');
    newItem.addActionListener(new newComponent());
    JMenuItem saveItem = new JMenuItem(messages.getString("GUIRendWorkspace.fileSave"));
    saveItem.setMnemonic('S');
    JMenuItem loadItem = new JMenuItem(messages.getString("GUIRendWorkspace.fileLoad"));
    loadItem.setMnemonic('L');
    JMenuItem sourceItem = new JMenuItem(messages.getString("GUIRendWorkspace.fileSource"));
    sourceItem.setMnemonic('O');
    JMenuItem aboutItem = new JMenuItem(messages.getString("GUIRendWorkspace.fileAbout"));
    aboutItem.setMnemonic('A');
    fileMenu.add(newItem);
    fileMenu.add(sourceItem);
    fileMenu.add(aboutItem);

    JMenu windowMenu = new JMenu(messages.getString("GUIRendWorkspace.window"));
    windowMenu.setMnemonic('W');
    JMenuItem showWindowItem = new JMenuItem(messages.getString("GUIRendWorkspace.windowShow"));
    JMenuItem hideWindowItem = new JMenuItem(messages.getString("GUIRendWorkspace.windowHide"));
    windowMenu.add(showWindowItem);
    windowMenu.add(hideWindowItem);

    // Creates the menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    menuBar.add(fileMenu);
  }
 /*
  * The following method creates the font menu
  * postcondition: returns the JMenu for the font menu.
  */
 public JMenu createFontMenu() {
   JMenu menu = new JMenu(new String("Font"));
   menu.add(createFontNameMenu());
   menu.add(createFontSizeMenu());
   menu.add(createFontStyleMenu());
   return menu;
 } // end createFontMenu method
Exemple #6
0
 /**
  * Make the edit menu
  *
  * @param editMenu edit menu
  * @return edit menu
  */
 public JMenu makeEditMenu(JMenu editMenu) {
   editMenu.add(GuiUtils.makeDynamicMenu("Symbols", this, "initSymbolsMenu"));
   editMenu.add(
       GuiUtils.makeMenuItem("Set properties on selected", this, "setPropertiesOnSelected"));
   editMenu.addSeparator();
   return super.makeEditMenu(editMenu);
 }
 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");
     actionAddMajorVersion = new ActionAddMajorVersion();
     if (container instanceof ICFInternetRealProjectObj) {
       menuItem = new JMenuItem(actionAddMajorVersion);
       menuAdd.add(menuItem);
     }
     actionAddMinorVersion = new ActionAddMinorVersion();
     if (container instanceof ICFInternetMajorVersionObj) {
       menuItem = new JMenuItem(actionAddMinorVersion);
       menuAdd.add(menuItem);
     }
     if (getSwingContainer() != null) {
       panelMenuBar.add(menuAdd);
     }
     menuSelected = new JMenu("Selected");
     menuSelected.setEnabled(false);
     actionViewSelected = new ViewSelectedActionVersion();
     menuItem = new JMenuItem(actionViewSelected);
     menuSelected.add(menuItem);
     actionEditSelected = new EditSelectedActionVersion();
     menuItem = new JMenuItem(actionEditSelected);
     menuSelected.add(menuItem);
     actionDeleteSelected = new DeleteSelectedActionVersion();
     menuItem = new JMenuItem(actionDeleteSelected);
     menuSelected.add(menuItem);
     panelMenuBar.add(menuSelected);
   }
   return (panelMenuBar);
 }
  public TestSwingExample1() {
    super("ActionExample");

    setChannel(currentChannel); // enable/disable the Actions as appropriate

    channelLabel.setHorizontalAlignment(JLabel.CENTER);
    channelLabel.setFont(new Font("Serif", Font.PLAIN, 32));

    getContentPane().add(channelLabel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16));
    getContentPane().add(buttonPanel, BorderLayout.CENTER);

    buttonPanel.add(new JButton(upAction));
    buttonPanel.add(new JButton(gotoFavoriteAction));
    buttonPanel.add(new JButton(downAction));
    buttonPanel.add(new JButton(setFavoriteAction));

    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("Channel");
    menu.add(new JMenuItem(upAction));
    menu.add(new JMenuItem(downAction));
    menu.addSeparator();
    menu.add(new JMenuItem(gotoFavoriteAction));
    menu.add(new JMenuItem(setFavoriteAction));
    mb.add(menu);
    setJMenuBar(mb);
  }
Exemple #10
0
 /** * Creates a Simple Neon Hex Frame Application * @throws IOException */
 public Main() throws IOException {
   super("Hex");
   setIconImage(Toolkit.getDefaultToolkit().getImage("images\\s1.png"));
   // Add in a menu
   JMenuBar menuBar = new JMenuBar();
   JMenu gameMenu = new JMenu("Game");
   gameMenu.setMnemonic('G');
   newMenuItem = new JMenuItem("New Game");
   newMenuItem.addActionListener(this);
   quitMenuItem = new JMenuItem("Exit");
   quitMenuItem.addActionListener(this);
   gameMenu.add(newMenuItem);
   gameMenu.addSeparator();
   gameMenu.add(quitMenuItem);
   menuBar.add(gameMenu);
   JMenu helpMenu = new JMenu("Help");
   helpMenu.setMnemonic('H');
   aboutMenuItem = new JMenuItem("About...");
   aboutMenuItem.addActionListener(this);
   helpMenu.add(aboutMenuItem);
   menuBar.add(helpMenu);
   setJMenuBar(menuBar);
   // Set up the layout
   // Centre the frame in the middle (almost) of the screen
   setLayout(new BorderLayout());
   tableArea = new Board();
   add(tableArea, BorderLayout.CENTER);
   Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
   setLocation((screen.width - Board.WIDTH) / 2, (screen.height - Board.HEIGHT) / 2 - 52);
   setResizable(false);
 }
  protected JMenu buildFileMenu() {
    JMenu file = new JMenu("File");
    JMenuItem newWin = new JMenuItem("New");
    JMenuItem open = new JMenuItem("Open");
    JMenuItem quit = new JMenuItem("Quit");

    newWin.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            newDocument();
          }
        });

    open.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            openDocument();
          }
        });

    quit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            quit();
          }
        });

    file.add(newWin);
    file.add(open);
    file.addSeparator();
    file.add(quit);
    return file;
  }
  protected JMenu buildEditMenu() {
    JMenu edit = new JMenu("Edit");
    JMenuItem undo = new JMenuItem("Undo");
    JMenuItem copy = new JMenuItem("Copy");
    JMenuItem cut = new JMenuItem("Cut");
    JMenuItem paste = new JMenuItem("Paste");
    JMenuItem prefs = new JMenuItem("Preferences...");

    undo.setEnabled(false);
    copy.setEnabled(false);
    cut.setEnabled(false);
    paste.setEnabled(false);

    prefs.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            openPrefsWindow();
          }
        });

    edit.add(undo);
    edit.addSeparator();
    edit.add(cut);
    edit.add(copy);
    edit.add(paste);
    edit.addSeparator();
    edit.add(prefs);
    return edit;
  }
Exemple #13
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 */
  private void buildMenu() {
    fooMenu = new JMenu("File");
    fooMenu.setMnemonic('F');

    JMenuItem aboutItem = new JMenuItem("About...");
    aboutItem.setMnemonic('A');
    aboutItem.setEnabled(true);
    aboutItem.setIcon(new ImageIcon(this.getClass().getResource("/comment.png")));
    aboutItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JLabel imageLabel =
                new JLabel(new ImageIcon(this.getClass().getResource("/solve_all_problems.gif")));
            JOptionPane.showMessageDialog(null, imageLabel, "About", JOptionPane.PLAIN_MESSAGE);
          }
        });

    JMenuItem exitItem = new JMenuItem("Exit");
    exitItem.setMnemonic('x');
    exitItem.setEnabled(true);
    exitItem.setIcon(new ImageIcon(this.getClass().getResource("/delete.png")));
    exitItem.addActionListener(this);

    fooMenu.add(aboutItem);
    fooMenu.addSeparator();
    fooMenu.add(exitItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fooMenu);
    setJMenuBar(menuBar);
  }
  /** Return a menu for DesktopWindow and add a special listener. */
  public static JMenu getCurrencyMenu(ActionListener listener) {
    JRadioButtonMenuItem menuItem;
    String defaultCurrency = Money.getCurrencyFor(Money.getDefaultCurrency());

    JMenu menu = new JMenu("Währung");
    ButtonGroup group = new ButtonGroup();

    JMenu europeanMenu = new JMenu("Europa");
    String europeanCurrencies[] = Money.getEuropeanCurrencyList();

    for (int i = 0; i < europeanCurrencies.length; i++) {
      menuItem = new RadioCurrencyMenuItem(europeanCurrencies[i]);
      menuItem.addActionListener(listener);
      europeanMenu.add(menuItem);

      group.add(menuItem);

      if (europeanCurrencies[i].startsWith(defaultCurrency)) {
        menuItem.setSelected(true);
      }

      if (i == 0) {
        europeanMenu.addSeparator();
      }
    }

    menu.add(europeanMenu);

    return menu;
  }
 public JMenuBar getPanelMenuBar() {
   if (panelMenuBar == null) {
     JMenuItem menuItem;
     ICFLibAnyObj container = getSwingContainer();
     panelMenuBar = new JMenuBar();
     menuAdd = new JMenu("Add");
     actionAddTextCol = new ActionAddTextCol();
     if (container instanceof ICFDbTestTableObj) {
       menuItem = new JMenuItem(actionAddTextCol);
       menuAdd.add(menuItem);
     }
     actionAddTextType = new ActionAddTextType();
     if (container instanceof ICFDbTestSchemaDefObj) {
       menuItem = new JMenuItem(actionAddTextType);
       menuAdd.add(menuItem);
     }
     if (getSwingContainer() != null) {
       panelMenuBar.add(menuAdd);
     }
     menuSelected = new JMenu("Selected");
     menuSelected.setEnabled(false);
     actionViewSelected = new ViewSelectedActionTextDef();
     menuItem = new JMenuItem(actionViewSelected);
     menuSelected.add(menuItem);
     actionEditSelected = new EditSelectedActionTextDef();
     menuItem = new JMenuItem(actionEditSelected);
     menuSelected.add(menuItem);
     actionDeleteSelected = new DeleteSelectedActionTextDef();
     menuItem = new JMenuItem(actionDeleteSelected);
     menuSelected.add(menuItem);
     panelMenuBar.add(menuSelected);
   }
   return (panelMenuBar);
 }
Exemple #17
0
  /*
   * Frame Constructor
   */
  public EvalGUI() {

    // map image

    Image img = null;
    try {
      img = ImageIO.read(new File("map2.png"));
    } catch (IOException e) {
    }

    img = img.getScaledInstance(300, 300, Image.SCALE_SMOOTH);

    JLabel small_img = new JLabel(new ImageIcon(img));

    getContentPane().setLayout(new BorderLayout());

    Right_Panel.add(Statistics_Panel, BorderLayout.CENTER);

    Statistics_Panel.add(dist_title);
    Statistics_Panel.add(totaldistance);
    Statistics_Panel.add(dist_curr_obj);
    Statistics_Panel.add(dist_charge);
    Statistics_Panel.add(clean_title);
    Statistics_Panel.add(space_covered);
    Statistics_Panel.add(room_covered);
    Statistics_Panel.add(charge_visits);
    Statistics_Panel.add(battery_title);
    Statistics_Panel.add(batt_remaining);
    Statistics_Panel.add(coverage_title);
    Statistics_Panel.add(nr_coverage_divisions);
    Statistics_Panel.add(vert_hor_div);
    Statistics_Panel.add(rob_coord);
    Statistics_Panel.add(time_elapsed);
    Statistics_Panel.add(time_completion);
    Right_Panel.add(small_img, BorderLayout.SOUTH);

    add(Right_Panel, BorderLayout.EAST);
    add(Map_Panel, BorderLayout.WEST);

    // menu items
    menubar.add(file);
    menubar.add(options);
    menubar.add(exit);
    file.add(newmap);
    options.add(measure);
    options.add(speed);
    exit.add(exit_);
    setJMenuBar(menubar);

    // frame operations
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(860, 650);
    setTitle("EvaluationGUI");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // pack();

  }
 /*
  * The following method creates the submenu to choose a font style
  * postcondition: returns the JMenu for the font style submenu.
  */
 public JMenu createFontStyleMenu() {
   JMenu menu = new JMenu(new String("Style"));
   menu.add(createFontStyleItem(new String("Plain")));
   menu.add(createFontStyleItem(new String("Italic")));
   menu.add(createFontStyleItem(new String("Bold")));
   menu.add(createFontStyleItem(new String("Bold Italic")));
   return menu;
 } // end createFontStyleMenu method
Exemple #19
0
  /**
   * _more_
   *
   * @param symbols _more_
   * @param listener _more_
   * @param smm _more_
   * @return _more_
   */
  public static List makeStationModelMenuItems(
      List symbols, final ObjectListener listener, StationModelManager smm) {
    List items = new ArrayList();
    List subMenus = new ArrayList();
    Hashtable categories = new Hashtable();
    for (int i = 0; i < symbols.size(); i++) {
      StationModel sm = (StationModel) symbols.get(i);
      boolean isUsers = smm.isUsers(sm);
      String name = sm.getName();
      if (name.equals("")) continue;
      List toks = StringUtil.split(name, ">", true, true);
      if (toks.size() > 0) {
        name = (String) toks.get(toks.size() - 1);
      }
      JMenuItem item = new JMenuItem(GuiUtils.getLocalName(name, isUsers));
      item.addActionListener(
          new ObjectListener(sm) {
            public void actionPerformed(ActionEvent ae) {
              listener.setObject(this.theObject);
              listener.actionPerformed(ae);
            }
          });

      toks.remove(toks.size() - 1);
      if (toks.size() == 0) {
        items.add(item);
        continue;
      }
      JMenu categoryMenu = null;
      String catSoFar = "";
      String menuCategory = "";
      for (int catIdx = 0; catIdx < toks.size(); catIdx++) {
        String subCat = (String) toks.get(catIdx);
        catSoFar = catSoFar + "/" + subCat;
        JMenu m = (JMenu) categories.get(catSoFar);
        if (m == null) {
          m = new JMenu(subCat);
          menuCategory = catSoFar;
          categories.put(catSoFar, m);
          if (categoryMenu != null) {
            categoryMenu.add(m, 0);
          } else {
            subMenus.add(m);
          }
        }
        categoryMenu = m;
      }
      if (categoryMenu == null) {
        categoryMenu = new JMenu("");
        categories.put(toks.toString(), categoryMenu);
        subMenus.add(categoryMenu);
        menuCategory = toks.toString();
      }
      categoryMenu.add(item);
    }
    items.addAll(subMenus);
    return items;
  }
  public void start() {
    menu.setMnemonic('f');
    submenu.setMnemonic('m');
    menu.add(submenu);
    submenu.add(item);
    bar.add(menu);
    frame.setJMenuBar(bar);
    frame.pack();

    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Sysout.println(e.toString());
            synchronized (activated) {
              activated.set(true);
              activated.notifyAll();
            }
          }
        });

    frame.setVisible(true);
    Util.waitForIdle(robot);

    boolean isMacOSX = (OSInfo.getOSType() == OSInfo.OSType.MACOSX);
    if (isMacOSX) {
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.delay(20);
    }
    robot.keyPress(KeyEvent.VK_ALT);
    robot.delay(20);
    robot.keyPress(KeyEvent.VK_F);
    robot.delay(20);
    robot.keyRelease(KeyEvent.VK_F);
    robot.delay(20);
    robot.keyRelease(KeyEvent.VK_ALT);
    if (isMacOSX) {
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.delay(20);
    }
    Util.waitForIdle(robot);

    robot.keyPress(KeyEvent.VK_M);
    robot.delay(20);
    robot.keyRelease(KeyEvent.VK_M);
    Util.waitForIdle(robot);

    robot.keyPress(KeyEvent.VK_SPACE);
    robot.delay(20);
    robot.keyRelease(KeyEvent.VK_SPACE);
    Util.waitForIdle(robot);

    if (!Util.waitForCondition(activated, 2000)) {
      throw new TestFailedException("a submenu wasn't activated by mnemonic key press");
    }

    Sysout.println("Test passed.");
  }
Exemple #21
0
  void addActionsToMenus(JMenu datasetMenu, JMenu configMenu, JMenu toolMenu) {
    // Info
    BAMutil.addActionToMenu(datasetMenu, showGridTableAction);
    BAMutil.addActionToMenu(datasetMenu, showDatasetInfoAction);
    BAMutil.addActionToMenu(datasetMenu, showNcMLAction);
    BAMutil.addActionToMenu(datasetMenu, showGridDatasetInfoAction);
    BAMutil.addActionToMenu(datasetMenu, showNetcdfDatasetAction);
    // BAMutil.addActionToMenu( datasetMenu, geotiffAction);
    // BAMutil.addActionToMenu( infoMenu, showNetcdfXMLAction);

    /// Configure
    JMenu toolbarMenu = new JMenu("Toolbars");
    toolbarMenu.setMnemonic('T');
    configMenu.add(toolbarMenu);
    BAMutil.addActionToMenu(toolbarMenu, navToolbarAction);
    BAMutil.addActionToMenu(toolbarMenu, moveToolbarAction);

    BAMutil.addActionToMenu(configMenu, chooseProjectionAction);
    BAMutil.addActionToMenu(configMenu, saveCurrentProjectionAction);

    /* BAMutil.addActionToMenu( configMenu, chooseColorScaleAction);
    BAMutil.addActionToMenu( configMenu, controller.dataProjectionAction);
    */

    //// tools menu
    JMenu displayMenu = new JMenu("Display control");
    displayMenu.setMnemonic('D');

    BAMutil.addActionToMenu(displayMenu, controller.showGridAction);
    BAMutil.addActionToMenu(displayMenu, controller.showContoursAction);
    BAMutil.addActionToMenu(displayMenu, controller.showContourLabelsAction);
    BAMutil.addActionToMenu(displayMenu, redrawAction);
    toolMenu.add(displayMenu);

    // Loop Control
    JMenu loopMenu = new JMenu("Loop control");
    loopMenu.setMnemonic('L');

    BAMutil.addActionToMenu(loopMenu, fieldLoopAction);
    BAMutil.addActionToMenu(loopMenu, levelLoopAction);
    BAMutil.addActionToMenu(loopMenu, timeLoopAction);
    toolMenu.add(loopMenu);

    // MinMax Control
    JMenu mmMenu = new JMenu("ColorScale min/max");
    mmMenu.setMnemonic('C');
    BAMutil.addActionToMenu(mmMenu, minmaxHorizAction);
    BAMutil.addActionToMenu(mmMenu, minmaxLogAction);
    BAMutil.addActionToMenu(mmMenu, minmaxHoldAction);
    toolMenu.add(mmMenu);

    // Zoom/Pan
    JMenu zoomMenu = new JMenu("Zoom/Pan");
    zoomMenu.setMnemonic('Z');
    panz.addActionsToMenu(zoomMenu); // items are added by NavigatedPanelToolbar
    toolMenu.add(zoomMenu);
  }
  /** Builds the MenuBar */
  private void buildUI() {
    // Construct menu items
    JMenu lookAndFeel = new JMenu("Look and feel");
    JRadioButtonMenuItem nativeLaF = new JRadioButtonMenuItem("Native", true);
    JRadioButtonMenuItem javaLaF = new JRadioButtonMenuItem("Java (Metal)");
    JRadioButtonMenuItem motifLaF = new JRadioButtonMenuItem("Motif");
    JMenu help = new JMenu("Help");
    JMenuItem about = new JMenuItem("About");

    // Add menu items to menu bar
    add(lookAndFeel);
    lookAndFeel.add(nativeLaF);
    lookAndFeel.add(javaLaF);
    lookAndFeel.add(motifLaF);
    add(Box.createHorizontalGlue());
    add(help);
    help.add(about);

    // Add buttons to button group
    ButtonGroup laFGroup = new ButtonGroup();
    laFGroup.add(nativeLaF);
    laFGroup.add(javaLaF);
    laFGroup.add(motifLaF);

    // Set action listeners
    nativeLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, UIManager.getSystemLookAndFeelClassName());
            owner.pack();
          }
        });

    javaLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, UIManager.getCrossPlatformLookAndFeelClassName());
            owner.pack();
          }
        });

    motifLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, "com.sun.java.swing.plaf.motif.MotifLookAndFeel");
            owner.pack();
          }
        });

    about.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.showAboutDialog(owner);
          }
        });
  }
  /**
   * Creates the Titled Tab menu
   *
   * @return the titled tab menu
   */
  private JMenu createTitledTabMenu() {
    JMenu titledTabMenu = new JMenu("Titled Tab");

    // Get all avaliable directions
    Direction[] directions = Direction.getDirections();
    for (int i = 0; i < directions.length; i++) {
      final Direction direction = directions[i];
      titledTabMenu.add(
          createMenuItem(
              "Direction: " + direction.getName(),
              new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                  // Sets in what direction the icon, text and title
                  // components are laid out (as a line).
                  // If no direction have been set for the highlighted and/or
                  // disabled state then those
                  // states will use the direction for the normal state and
                  // therefore we only need to
                  // set the direction for the normal state because we want
                  // the same direction for all
                  // states in this example. The titled tab is automatically
                  // updated.
                  titledTabProperties.getNormalProperties().setDirection(direction);
                }
              }));
    }

    titledTabMenu.add(new JSeparator());

    // Get all size policies
    TitledTabSizePolicy[] titledTabSizePolicies = TitledTabSizePolicy.getSizePolicies();
    for (int i = 0; i < titledTabSizePolicies.length; i++) {
      final TitledTabSizePolicy titledTabSizePolicy = titledTabSizePolicies[i];
      titledTabMenu.add(
          createMenuItem(
              "Size Policy: " + titledTabSizePolicy.getName(),
              new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                  // Sets the size policy for the entire titled tab. This
                  // means that if equal size is
                  // set then titled tab will calculate its maximum size for
                  // all its state and use that
                  // size regardless of the current state for the tab. If
                  // individual size is used then
                  // titled tab will only use the size for the active state
                  // even i.e. if the states have
                  // different sizes i.e. titled tab will change size
                  // depending on what state it is in.
                  // The titled tab is automatically updated.
                  titledTabProperties.setSizePolicy(titledTabSizePolicy);
                }
              }));
    }

    return titledTabMenu;
  }
Exemple #24
0
  void makeMenu() {
    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu(strings.getString("menu.file"));
    menuBar.add(fileMenu);

    JMenuItem menuItem;
    menuItem = new JMenuItem(strings.getString("menu.file.new"));
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            onNewFileClicked();
          }
        });
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(strings.getString("menu.file.open"));
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            onOpenFileClicked();
          }
        });
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(strings.getString("menu.file.save"));
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            onSaveFileClicked();
          }
        });
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(strings.getString("menu.file.save_as"));
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            onSaveAsFileClicked();
          }
        });
    fileMenu.add(menuItem);

    menuItem = new JMenuItem(strings.getString("menu.file.exit"));
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            closeWindow();
          }
        });
    fileMenu.add(menuItem);

    setJMenuBar(menuBar);
  }
  private void addMenuItems(JMenu menu) {
    menu.add(myRestoreAction);
    menu.add(myIconifyAction);
    if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
      menu.add(myMaximizeAction);
    }

    menu.add(new JSeparator());

    menu.add(myCloseAction);
  }
Exemple #26
0
  private void creerMenu() {
    menuBar = new JMenuBar();
    menuOption.add(menuNouvellePartie);
    menuOption.add(menuScore);

    menuBar.add(menuOption);
    menuBar.add(pause);
    menuBar.add(hint);

    setJMenuBar(menuBar);
  }
Exemple #27
0
  public IvusFrame(World world) {
    OrbitView view = (world != null) ? new OrbitView(world) : new OrbitView();
    view.setAxesOrientation(AxesOrientation.XRIGHT_YOUT_ZDOWN);
    ViewCanvas canvas = new ViewCanvas(view);
    canvas.setView(view);

    ModeManager mm = new ModeManager();
    mm.add(canvas);
    OrbitViewMode ovm = new OrbitViewMode(mm);
    SelectDragMode sdm = new SelectDragMode(mm);

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    Action exitAction =
        new AbstractAction("Exit") {
          private static final long serialVersionUID = 1L;

          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        };
    JMenuItem exitItem = fileMenu.add(exitAction);
    exitItem.setMnemonic('x');

    JMenu modeMenu = new JMenu("Mode");
    modeMenu.setMnemonic('M');
    JMenuItem ovmItem = new ModeMenuItem(ovm);
    modeMenu.add(ovmItem);
    JMenuItem sdmItem = new ModeMenuItem(sdm);
    modeMenu.add(sdmItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(modeMenu);

    JToolBar toolBar = new JToolBar(SwingConstants.VERTICAL);
    toolBar.setRollover(true);
    JToggleButton ovmButton = new ModeToggleButton(ovm);
    toolBar.add(ovmButton);
    JToggleButton sdmButton = new ModeToggleButton(sdm);
    toolBar.add(sdmButton);

    ovm.setActive(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(new Dimension(SIZE, SIZE));
    this.add(canvas, BorderLayout.CENTER);
    this.add(toolBar, BorderLayout.WEST);
    this.setJMenuBar(menuBar);
  }
Exemple #28
0
  private JMenuBar createMenuBar() {
    JMenu menu = new JMenu("Menu");

    disablingItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));

    menu.add(disablingItem);
    menu.addSeparator();

    blurItem.setSelected(true);
    blurItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_MASK));
    menu.add(blurItem);

    embossItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, InputEvent.ALT_MASK));
    menu.add(embossItem);

    busyPainterItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.ALT_MASK));
    menu.add(busyPainterItem);

    ButtonGroup group = new ButtonGroup();
    group.add(blurItem);
    group.add(embossItem);
    group.add(busyPainterItem);

    ItemListener menuListener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (blurItem.isSelected()) {
              //                    layer.setUI(blurUI);
            } else if (embossItem.isSelected()) {
              //                    layer.setUI(embossUI);
            } else if (busyPainterItem.isSelected()) {
              layer.setUI(busyPainterUI);
            }
          }
        };

    blurItem.addItemListener(menuListener);
    embossItem.addItemListener(menuListener);
    busyPainterItem.addItemListener(menuListener);

    //        embossUI.getUnlockButton().addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                disablingItem.doClick();
    //            }
    //        });

    JMenuBar bar = new JMenuBar();
    bar.add(menu);

    bar.add(new LafMenu());
    return bar;
  }
Exemple #29
0
  protected JMenu getModelingMenu() {
    JMenu modelingMenu = new JMenu(STRINGS.MODELING_MENU);

    JMenuItem ganntMenuItem = new JMenuItem();
    ganntMenuItem.setText(STRINGS.GANTT);
    modelingMenu.add(ganntMenuItem);

    JMenuItem parameterMenuItem = new JMenuItem();
    parameterMenuItem.setText(STRINGS.CPU_PARAMETERS);
    modelingMenu.add(parameterMenuItem);

    return modelingMenu;
  }
  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);

  }