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;
  }
  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);
      }
    }
  }
Exemplo n.º 3
0
  /** Intialize me */
  private void init() {
    myTables = new ArrayList();
    tableTabbedPane = new JTabbedPane();
    tableTabbedPane.setPreferredSize(new Dimension(450, 200));
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    fileMenu.add(GuiUtils.makeMenuItem("New Row", this, "addNewRow"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Open", this, "doOpen"));
    fileMenu.add(GuiUtils.makeMenuItem("Import", this, "doImport"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Export to File", this, "doSaveAs"));
    fileMenu.add(GuiUtils.makeMenuItem("Export to Plugin", this, "exportToPlugin"));
    fileMenu.add(
        GuiUtils.makeMenuItem("Export Selected to Plugin", this, "exportSelectedToPlugin"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Close", this, "doClose"));

    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    helpMenu.add(GuiUtils.makeMenuItem("Parameter Defaults Help", this, "showHelp"));
    JComponent bottom = GuiUtils.wrap(GuiUtils.makeButton("Close", this, "doClose"));
    contents = GuiUtils.topCenterBottom(menuBar, GuiUtils.inset(tableTabbedPane, 2), bottom);
    setMenuBar(menuBar);
    loadResources(resources);
  }
Exemplo n.º 4
0
  private JMenu createGenomeSpaceMenu() {

    JMenu menu = new JMenu("GenomeSpace");

    MenuAction menuAction = null;
    menuAction = new LoadFromGSMenuAction("Load File from GenomeSpace...", KeyEvent.VK_U, igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.addSeparator();
    menuAction =
        new LoadGenomeFromGSMenuAction("Load Genome from GenomeSpace...", KeyEvent.VK_Z, igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.addSeparator();

    menuAction = new GSSaveSessionMenuAction("Save Session to GenomeSpace...", igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new GSOpenSessionMenuAction("Load Session from GenomeSpace...", igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.add(new JSeparator());
    menuAction =
        new MenuAction("Logout") {
          @Override
          public void actionPerformed(ActionEvent e) {
            GSUtils.logout();
            if (MessageUtils.confirm(
                "You must shutdown IGV to complete the GenomeSpace logout. Shutdown now?")) {
              doExitApplication();
            }
          }
        };
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.add(new JSeparator());
    menuAction =
        new MenuAction("Register... ") {

          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              BrowserLauncher.openURL(GENOMESPACE_REG_PAGE);
            } catch (IOException ex) {
              log.error("Error opening browser", ex);
            }
          }
        };
    menuAction.setToolTipText(GENOMESPACE_REG_TOOLTIP);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.setVisible(
        PreferenceManager.getInstance().getAsBoolean(PreferenceManager.GENOME_SPACE_ENABLE));

    return menu;
  }
  /** Adds the menu represented by the node */
  private void addVisualMenu(RADMenuItemComponent comp) {
    Object o = getBeanInstance();
    Object m = comp.getBeanInstance();
    Object dto = getDesignTimeMenus(getFormManager()).getDesignTime(o);
    Object dtm = getDesignTimeMenus(getFormManager()).getDesignTime(m);

    switch (getMenuItemType()) {
      case T_MENUBAR:
        ((MenuBar) o).add((Menu) m);
        ((JMenuBar) dto).add((JMenu) dtm);
        ((JMenuBar) dto).validate();
        break;
      case T_MENU:
        if (comp.getMenuItemType() == T_SEPARATOR) {
          ((Menu) o).addSeparator();
          ((JMenu) dto).addSeparator();
        } else {
          ((Menu) o).add((MenuItem) m);
          ((JMenu) dto).add((JMenuItem) dtm);
        }
        break;
      case T_POPUPMENU:
        if (comp.getMenuItemType() == T_SEPARATOR) {
          ((Menu) o).addSeparator();
          ((JMenu) dto).addSeparator();
        } else {
          ((Menu) o).add((MenuItem) m);
          ((JPopupMenu) dto).add((JMenuItem) dtm);
        }
        break;
      case T_JMENUBAR:
        ((JMenuBar) o).add((JMenu) m);
        ((JMenuBar) o).validate();
        break;
      case T_JMENU:
        if (comp.getMenuItemType() == T_JSEPARATOR) {
          ((JMenu) o).addSeparator();
        } else {
          ((JMenu) o).add((JMenuItem) m);
        }
        break;
      case T_JPOPUPMENU:
        if (comp.getMenuItemType() == T_JSEPARATOR) {
          ((JPopupMenu) o).addSeparator();
        } else {
          ((JPopupMenu) o).add((JMenuItem) m);
        }
        break;
    }
  }
Exemplo n.º 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);
 }
Exemplo n.º 7
0
  /** 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;
  }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
0
  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);
  }
Exemplo n.º 10
0
  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);
  }
  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;
  }
Exemplo n.º 12
0
 /** Make the file menu */
 private void makeFileMenu() {
   fileMenu.removeAll();
   fileMenu.add(makeMenuItem("New", 'n', GuiUtils.CMD_NEW));
   fileMenu.addSeparator();
   fileMenu.add(makeMenuItem("Save", 's', GuiUtils.CMD_SAVE));
   fileMenu.add(makeMenuItem("Save As...", GuiUtils.CMD_SAVEAS));
   fileMenu.add(makeMenuItem("Rename...", GuiUtils.CMD_RENAME));
   fileMenu.addSeparator();
   JMenuItem removeMenuItem = makeMenuItem("Remove", GuiUtils.CMD_REMOVE);
   removeMenuItem.setEnabled(smm.isUsers(stationModel));
   fileMenu.add(removeMenuItem);
   fileMenu.addSeparator();
   fileMenu.add(makeMenuItem("Import...", GuiUtils.CMD_IMPORT));
   fileMenu.add(makeMenuItem("Export...", GuiUtils.CMD_EXPORT));
   fileMenu.addSeparator();
   fileMenu.add(makeMenuItem("Close", GuiUtils.CMD_CLOSE));
 }
Exemplo n.º 13
0
  /**
   * Make the view menu
   *
   * @param viewMenu view menu
   * @return The view menu
   */
  public JMenu makeViewMenu(JMenu viewMenu) {
    showAlignmentPointsMI = new JCheckBoxMenuItem("Show Alignment Points", true);
    viewMenu.add(showAlignmentPointsMI);
    showAlignmentPointsMI.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            repaint();
          }
        });

    viewMenu.addSeparator();
    super.makeViewMenu(viewMenu);
    viewMenu.addSeparator();
    viewMenu.add(makeMenuItem("Black background", CMD_BLACKBG));
    viewMenu.add(makeMenuItem("White background", CMD_WHITEBG));
    return viewMenu;
  }
Exemplo n.º 14
0
  public DistributedTextEditor() {
    area1.setFont(new Font("Monospaced", Font.PLAIN, 12));

    area2.setFont(new Font("Monospaced", Font.PLAIN, 12));
    ((AbstractDocument) area1.getDocument()).setDocumentFilter(dec);
    area2.setEditable(false);

    Container content = getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    JScrollPane scroll1 =
        new JScrollPane(
            area1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    content.add(scroll1, BorderLayout.CENTER);

    JScrollPane scroll2 =
        new JScrollPane(
            area2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    content.add(scroll2, BorderLayout.CENTER);

    content.add(ipaddress, BorderLayout.CENTER);
    content.add(portNumber, BorderLayout.CENTER);

    JMenuBar JMB = new JMenuBar();
    setJMenuBar(JMB);
    JMenu file = new JMenu("File");
    JMenu edit = new JMenu("Edit");
    JMB.add(file);
    JMB.add(edit);

    file.add(Listen);
    file.add(Connect);
    file.add(Disconnect);
    file.addSeparator();
    file.add(Save);
    file.add(SaveAs);
    file.add(Quit);

    edit.add(Copy);
    edit.add(Paste);
    edit.getItem(0).setText("Copy");
    edit.getItem(1).setText("Paste");

    Save.setEnabled(false);
    SaveAs.setEnabled(false);
    Disconnect.setEnabled(false);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    area1.addKeyListener(k1);
    area1.addMouseListener(m1);
    setTitle("Disconnected");
    setVisible(true);
    area1.insert("Welcome to Hjortehandlerne's distributed text editor. \n", 0);

    this.addWindowListener(w1);
  }
Exemplo n.º 15
0
  /** Create the menu bar for the GUI */
  private void createMenu() {
    // Create menu bar
    menuBar = new JMenuBar();
    clientFrame.setJMenuBar(menuBar);

    // Create menus
    fileMenu = new JMenu("File");
    helpMenu = new JMenu("Help");

    // Add menus to bar
    menuBar.add(fileMenu);
    menuBar.add(helpMenu);

    // Create File Menu Items
    hostItem = new JCheckBoxMenuItem("Allow Uploads", true);
    portItem = new JCheckBoxMenuItem("Use Passive Mode", true);
    exitItem = new JMenuItem("Exit");

    // Add Items to File Menu
    fileMenu.add(hostItem);
    fileMenu.add(portItem);
    fileMenu.addSeparator();
    fileMenu.add(exitItem);

    // Create Help Menu Items
    helpItem = new JMenuItem("Help");
    aboutItem = new JMenuItem("About LeetFTP");

    // Add Items to Help Menu
    helpMenu.add(helpItem);
    helpMenu.addSeparator();
    helpMenu.add(aboutItem);

    // Create menu action handler and set it active
    MenuHandler menuHandler = new MenuHandler();

    hostItem.addActionListener(menuHandler);
    portItem.addActionListener(menuHandler);
    exitItem.addActionListener(menuHandler);
    helpItem.addActionListener(menuHandler);
    aboutItem.addActionListener(menuHandler);
  }
Exemplo n.º 16
0
 private JMenuBar buildMenuBar() {
   // This function builds the menu bar
   JMenuBar menuBar = new JMenuBar();
   JMenu fileMenu = new JMenu("File");
   fileMenu.add(makeMenuItem("New"));
   fileMenu.add(makeMenuItem("Open"));
   fileMenu.addSeparator();
   fileMenu.add(makeMenuItem("Save"));
   fileMenu.add(makeMenuItem("Save As"));
   fileMenu.addSeparator();
   fileMenu.add(makeMenuItem("Exit"));
   menuBar.add(fileMenu);
   // edit menu
   JMenu editMenu = new JMenu("Edit");
   editMenu.add(makeMenuItem(cutAction));
   editMenu.add(makeMenuItem(copyAction));
   editMenu.add(makeMenuItem(pasteAction));
   menuBar.add(editMenu);
   return menuBar;
 }
Exemplo n.º 17
0
  public DBJMenuBar(JMenuListener listener) {
    aJMenuListener = listener;

    fileJMenu = new JMenu("Datei");

    fileJMenuItem = new JMenuItem("Drucken");
    fileJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK));
    fileJMenuItem.setMnemonic((int) 'p');
    fileJMenu.add(fileJMenuItem);
    fileJMenuItem.addActionListener(aJMenuListener);

    fileJMenu.addSeparator();

    fileJMenuItem = new JMenuItem("Schliessen");
    fileJMenu.add(fileJMenuItem);
    fileJMenuItem.addActionListener(aJMenuListener);

    add(fileJMenu);

    selectJMenu = new JMenu("Anzeigen");
    selectJMenuItem = new JMenuItem("Rangliste");
    selectJMenu.add(selectJMenuItem);
    selectJMenuItem.addActionListener(aJMenuListener);

    selectJMenuItem = new JMenuItem("Verein");
    selectJMenu.add(selectJMenuItem);
    selectJMenuItem.addActionListener(aJMenuListener);

    selectJMenuItem = new JMenuItem("Schiedsrichter");
    selectJMenu.add(selectJMenuItem);
    selectJMenuItem.addActionListener(aJMenuListener);

    selectJMenuItem = new JMenuItem("Turnierdaten");
    selectJMenu.add(selectJMenuItem);
    selectJMenuItem.addActionListener(aJMenuListener);

    add(selectJMenu);

    editJMenu = new JMenu("Erstellen&Suchen");
    editJMenuItem = new JMenuItem("Person erstellen/suchen");
    editJMenu.add(editJMenuItem);
    editJMenuItem.addActionListener(aJMenuListener);

    add(editJMenu);

    infoJMenu = new JMenu("Info");

    infoJMenuItem = new JMenuItem("Tabelleninfo");
    infoJMenu.add(infoJMenuItem);
    infoJMenuItem.addActionListener(aJMenuListener);

    add(infoJMenu);
  }
Exemplo n.º 18
0
 /**
  * Creates the attributes menu and its submenus. Clients override this method to add additional
  * menu items.
  */
 protected JMenu createAttributesMenu() {
   JMenu menu = new JMenu("Attributes");
   menu.add(createColorMenu("Fill Color", "FillColor"));
   menu.add(createColorMenu("Pen Color", "FrameColor"));
   menu.add(createArrowMenu());
   menu.addSeparator();
   menu.add(createFontMenu());
   menu.add(createFontSizeMenu());
   menu.add(createFontStyleMenu());
   menu.add(createColorMenu("Text Color", "TextColor"));
   return menu;
 }
Exemplo n.º 19
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;
 }
Exemplo n.º 20
0
  private void loadMenu() {
    ActionListener actionListener = new MenuItemsActionHandler();
    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");
    fileMenu.add(
        createMenuItem(
            NEW_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_N, MENU_SHORTCUT_KEY),
            actionListener));
    fileMenu.add(
        createMenuItem(
            OPEN_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_O, MENU_SHORTCUT_KEY),
            actionListener));

    fileMenu.addSeparator();

    fileMenu.add(
        createMenuItem(
            SAVE_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_SHORTCUT_KEY),
            actionListener));
    fileMenu.add(
        createMenuItem(
            SAVE_AS_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_SHORTCUT_KEY | InputEvent.SHIFT_MASK),
            actionListener));

    // need a field for this to enable/disable with selection status
    mEditMenu = new JMenu("Edit");

    mEditMenu.add(
        createMenuItem(
            COPY_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_SHORTCUT_KEY),
            actionListener));
    mEditMenu.add(
        createMenuItem(
            COPY_FORMULA_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_SHORTCUT_KEY | InputEvent.SHIFT_MASK),
            actionListener));
    mEditMenu.add(
        createMenuItem(
            PASTE_MENU_ITEM_NAME,
            KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_SHORTCUT_KEY),
            actionListener));

    menuBar.add(fileMenu);
    menuBar.add(mEditMenu);
    setJMenuBar(menuBar);
  }
Exemplo n.º 21
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;
  }
Exemplo n.º 22
0
  /** Este método crea un menú superior que esconde algunas opciones importantes. */
  private void crearMenuSuperior() {
    barraDeMenu = new JMenuBar();
    JMenu menuPrincipal = new JMenu("Opciones");
    JMenuItem destaparCartas = new JMenuItem("Destapar cartas");
    JMenuItem resetear = new JMenuItem("Volver a empezar");

    JMenuItem salirJuego = new JMenuItem("Salir");

    destaparCartas.addActionListener(this);
    resetear.addActionListener(this);
    salirJuego.addActionListener(this);

    menuPrincipal.add(destaparCartas);
    menuPrincipal.add(resetear);
    menuPrincipal.addSeparator();

    menuPrincipal.addSeparator();
    menuPrincipal.add(salirJuego);
    barraDeMenu.add(menuPrincipal);

    ventana.setJMenuBar(barraDeMenu);
  }
Exemplo n.º 23
0
  /*
   * 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);
  }
Exemplo n.º 24
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;
 }
Exemplo n.º 25
0
  public void initUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      JPopupMenu.setDefaultLightWeightPopupEnabled(false);
      frame = new JFrame("Project Benelux | 317 | Fullscreen - Resizeable");
      frame.setLayout(new BorderLayout());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      gamePanel = new JPanel();
      new AutoUpdater().run();
      webclient = false;
      gamePanel.setLayout(new BorderLayout());
      gamePanel.add(this);
      JMenu fileMenu = new JMenu("File");

      String[] mainButtons = new String[] {"-", "Exit", "-"};

      for (String name : mainButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) {
          fileMenu.addSeparator();
        } else {
          menuItem.addActionListener(this);
          fileMenu.add(menuItem);
        }
      }

      JMenuBar menuBar = new JMenuBar();
      JMenuBar jmenubar = new JMenuBar();
      Dimension dimension1 = new Dimension(765 + 16, 503 + 59);
      frame.setMinimumSize(dimension1);
      frame.add(jmenubar);
      menuBar.add(fileMenu);
      frame.getContentPane().add(menuBar, BorderLayout.NORTH);
      frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
      frame.pack();

      frame.setVisible(true); // can see the client
      frame.setResizable(true); // resizeable frame
      init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 26
0
 private void createDebugMenu() {
   debugMenu = new JMenu("Debug");
   menuBar.add(debugMenu);
   debugMenu.add(stepAction);
   debugMenu.add(nextAction);
   debugMenu.add(contAction);
   debugMenu.add(stopAction);
   traceAllItem = new JCheckBoxMenuItem("Trace All");
   debugMenu.add(traceAllItem);
   debugMenu.addSeparator();
   breakpointsItem = new JMenuItem("Breakpoints...");
   debugMenu.add(breakpointsItem);
   breakpointsItem.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           Breakpoints.edit();
         }
       });
   Breakpoints.setParent(this);
 }
Exemplo n.º 27
0
  private void creerBarreMenus() {
    JMenuBar barreMenus = new JMenuBar();

    JMenu menuFichier = new JMenu("Fichier");
    itemNouveau = new JMenuItem("Nouveau");
    itemOuvrir = new JMenuItem("Ouvrir");
    itemEnregistrer = new JMenuItem("Enregistrer");
    itemQuitter = new JMenuItem("Quitter");
    menuFichier.add(itemNouveau);
    menuFichier.add(itemOuvrir);
    menuFichier.add(itemEnregistrer);
    menuFichier.addSeparator();
    menuFichier.add(itemQuitter);
    barreMenus.add(menuFichier);

    this.setJMenuBar(barreMenus);
    itemNouveau.setEnabled(false);
    itemOuvrir.setEnabled(false);
    itemEnregistrer.setEnabled(false);
  }
Exemplo n.º 28
0
  private void initUI() {
    // Create tabbed pane with commands in it
    tabbedPane = new JTabbedPane();
    getContentPane().add(tabbedPane, BorderLayout.NORTH);

    tabbedPane.addTab("Book", null, createBookPane(), "View book information");
    tabbedPane.addTab("Author", null, createAuthorPane(), "View author information");
    tabbedPane.addTab("Customer", null, createCustomerPane(), "View customer information");
    tabbedPane.addTab("Borrow Book", null, createBorrowPane(), "Borrow books for a customer");
    tabbedPane.addTab("Return Book", null, createReturnPane(), "Return books for a customer");

    // Create output area with scrollpane
    outputArea = new JTextArea();
    // outputArea.setFont(new Font("Monospaced",Font.PLAIN,12));
    outputArea.setFont(new Font("Monospaced", Font.ROMAN_BASELINE, 12));
    outputArea.setEditable(false);
    outputArea.setFocusable(false);
    outputArea.setTabSize(2);
    JScrollPane sp = new JScrollPane(outputArea);
    sp.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS);

    getContentPane().add(sp, BorderLayout.CENTER);

    // Create menus
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');

    JMenuItem clearTextMenuItem = new JMenuItem(clearTextAction);
    JMenuItem exitMenuItem = new JMenuItem(exitAction);

    fileMenu.add(clearTextMenuItem);
    fileMenu.addSeparator();
    fileMenu.add(exitMenuItem);

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

    // Pack it all
    pack();
  }
Exemplo n.º 29
0
    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);
    }
Exemplo n.º 30
0
  public SPanel(JFrame sframe) {
    balls = new Ball[B_WIDTH][B_HEIGHT];
    setBackground(Color.black);

    JMenuBar mb = new JMenuBar();
    sframe.setJMenuBar(mb);
    JMenu smenu = new JMenu("File");
    mb.add(smenu);
    smenu.setMnemonic('F');

    newgame = smenu.add("New Game");
    newgame.setMnemonic('N');
    smenu.addSeparator();
    quitgame = smenu.add("Quit Game");
    quitgame.setMnemonic('Q');
    ButtonHandler b = new ButtonHandler();
    quitgame.addActionListener(b);
    newgame.addActionListener(b);
    resetBoard();

    addMouseListener(new MouseHandler());
    addMouseMotionListener(new MouseMotionHandler());
  }