Examples of JMenu


Examples of javax.swing.JMenu

    public DcPictureFieldMenu(DcPictureField pf) {
        build(pf);
    }
       
    private void build(DcPictureField pf) {
        JMenu menuFile = ComponentFactory.getMenu(DcResources.getText("lblFile"));
        JMenu menuEdit = ComponentFactory.getMenu(DcResources.getText("lblEdit"));

        JMenuItem miSaveAs = ComponentFactory.getMenuItem(DcResources.getText("lblSaveAs"));
        JMenuItem miOpenFromFile = ComponentFactory.getMenuItem(DcResources.getText("lblOpenFromFile"));
        JMenuItem miOpenFromURL = ComponentFactory.getMenuItem(DcResources.getText("lblOpenFromURL"));
        JMenuItem miOpenFromClipboard = ComponentFactory.getMenuItem(DcResources.getText("lblOpenFromClipboard"));
       
        JMenuItem miRotateRight = ComponentFactory.getMenuItem(IconLibrary._icoRotateRight, DcResources.getText("lblRotateRight"));
        JMenuItem miRotateLeft = ComponentFactory.getMenuItem(IconLibrary._icoRotateLeft, DcResources.getText("lblRotateLeft"));
       
        JMenuItem miGrayscale = ComponentFactory.getMenuItem(IconLibrary._icoGrayscale, DcResources.getText("lblGrayscale"));
        JMenuItem miSharpen = ComponentFactory.getMenuItem(DcResources.getText("lblSharpen"));
        JMenuItem miBlur = ComponentFactory.getMenuItem(DcResources.getText("lblBlur"));
       
        JMenuItem miDelete = ComponentFactory.getMenuItem(DcResources.getText("lblDelete"));
       
        miRotateRight.setActionCommand("rotate_right");
        miRotateRight.addActionListener(pf);

        miRotateLeft.setActionCommand("rotate_left");
        miRotateLeft.addActionListener(pf);

        miGrayscale.setActionCommand("grayscale");
        miGrayscale.addActionListener(pf);

        miSharpen.setActionCommand("sharpen");
        miSharpen.addActionListener(pf);
       
        miBlur.setActionCommand("blur");
        miBlur.addActionListener(pf);

        miOpenFromFile.setActionCommand("open_from_file");
        miOpenFromFile.addActionListener(pf);

        miOpenFromURL.setActionCommand("open_from_url");
        miOpenFromURL.addActionListener(pf);

        miOpenFromClipboard.setActionCommand("open_from_clipboard");
        miOpenFromClipboard.addActionListener(pf);
       
        miDelete.setActionCommand("delete");
        miDelete.addActionListener(pf);
       
        miSaveAs.setActionCommand("Save as");
        miSaveAs.addActionListener(pf);
       
        menuFile.add(miOpenFromFile);
        menuFile.add(miOpenFromURL);
        menuFile.add(miOpenFromClipboard);
        menuFile.addSeparator();
        menuFile.add(miSaveAs);
       
        menuEdit.add(miRotateLeft);
        menuEdit.add(miRotateRight);
       
        menuEdit.addSeparator();
       
        menuEdit.add(miGrayscale);
        menuEdit.add(miSharpen);
        menuEdit.add(miBlur);
       
        menuEdit.addSeparator();
       
        menuEdit.add(miDelete);
       
        add(menuFile);
        add(menuEdit);
    }
View Full Code Here

Examples of javax.swing.JMenu

                }
            }
        }

        if (showMenu) {
            JMenu editMenu = createMenu();
            JMenuBar mb = ComponentFactory.getMenuBar();
            mb.add(editMenu);
           
            mb.setMinimumSize(new Dimension(100, 23));
            mb.setPreferredSize(new Dimension(100, 23));
View Full Code Here

Examples of javax.swing.JMenu

                  ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                   new Insets( 0, 0, 0, 0), 0, 0));
    }
   
    private JMenu createMenu() {
        JMenu menu = ComponentFactory.getMenu("Edit");
       
        JMenuItem menuSelectAll = ComponentFactory.getMenuItem(DcResources.getText("lblSelectAll"));
        JMenuItem menuUnselectAll = ComponentFactory.getMenuItem(DcResources.getText("lblUnselectAll"));
        JMenuItem menuInvertSelection = ComponentFactory.getMenuItem(DcResources.getText("lblInvertSelection"));

        menuSelectAll.addActionListener(this);
        menuSelectAll.setActionCommand("selectAll");
        menuUnselectAll.addActionListener(this);
        menuUnselectAll.setActionCommand("unselectAll");
        menuInvertSelection.addActionListener(this);
        menuInvertSelection.setActionCommand("invertSelection");
       
        menuSelectAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
        menuUnselectAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK));
        menuInvertSelection.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_MASK));
       
        menu.add(menuSelectAll);
        menu.add(menuUnselectAll);
        menu.addSeparator();
        menu.add(menuInvertSelection);
       
        return menu;
    }   
View Full Code Here

Examples of javax.swing.JMenu

   */
  public Accelerators()
      throws HeadlessException
  {
    JMenuBar menuBar = new JMenuBar();
    final JMenu c = new JMenu("Fha");
    c.add(new ActionMenuItem (new MyAction()));
    c.add(new ActionMenuItem (new MyAction()));
    menuBar.add(c);

    setJMenuBar(menuBar);
  }
View Full Code Here

Examples of javax.swing.JMenu

                PluginHelper.add(this, "Delete", DcModules.getCurrent().getIndex());
            }
           
            if (file != null && SecurityCentre.getInstance().getUser().isAdmin() && dco.getModule().isFileBacked()) {
               
                JMenu menuFile = ComponentFactory.getMenu(IconLibrary._icoDriveManager, DcResources.getText("lblFile"));
               
                JMenuItem miDelete = ComponentFactory.getMenuItem(IconLibrary._icoDelete, DcResources.getText("lblDeleteFile"));
                miDelete.addActionListener(this);
                miDelete.setActionCommand("deleteFile");
                miDelete.setEnabled(file.exists());

                JMenuItem miMove = ComponentFactory.getMenuItem(DcResources.getText("lblMoveFile"));
                miMove.addActionListener(this);
                miMove.setActionCommand("moveFile");
                miMove.setEnabled(file.exists());

                JMenuItem miLocateHP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnHashAndSize")));
                miLocateHP.addActionListener(this);
                miLocateHP.setActionCommand("locateFileHP");
                miLocateHP.setEnabled(!file.exists() && dco.isFilled(DcObject._SYS_FILEHASH) && dco.isFilled(DcObject._SYS_FILESIZE));
               
                JMenuItem miLocateMP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnFilenameAndSize")));
                miLocateMP.addActionListener(this);
                miLocateMP.setActionCommand("locateFileMP");
                miLocateMP.setEnabled(!file.exists() && dco.isFilled(DcObject._SYS_FILESIZE));           

                JMenuItem miLocateLP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnFilename")));
                miLocateLP.addActionListener(this);
                miLocateLP.setActionCommand("locateFileLP");
                miLocateLP.setEnabled(!file.exists());       
               
                menuFile.add(miDelete);
                menuFile.add(miMove);
                menuFile.add(miLocateHP);
                menuFile.add(miLocateMP);
                menuFile.add(miLocateLP);
               
                addSeparator();
                add(menuFile);
            }           
           
        } else {
            PluginHelper.add(this, "RemoveRow", DcModules.getCurrent().getIndex());
            PluginHelper.add(this, "AddRow", DcModules.getCurrent().getIndex());
        }  
       
        if (viewType == View._TYPE_SEARCH &&
            module.getIndex() == DcModules._USER &&
            SecurityCentre.getInstance().getUser().isAuthorized("SetPassword")) {

            addSeparator();
            PluginHelper.add(this, "SetPassword", "", dco, null, viewType, DcModules.getCurrent().getIndex());
        }

        if (!DcModules.getCurrent().isAbstract()) {
            addSeparator();
            PluginHelper.add(this, "ItemExporterWizard", "", dco, null, viewIdx, dco.getModule().getIndex());
        }
       
        if (viewType == View._TYPE_SEARCH && DcModules.getCurrent().hasReports()) {
            PluginHelper.add(this, "Report", "", dco, null, viewIdx, DcModules.getCurrent().getIndex());
        }
       
        addSeparator();
        PluginHelper.add(this, "Sort");
       
        if viewType == View._TYPE_SEARCH &&
            module.canBeLend() &&
            SecurityCentre.getInstance().getUser().isAuthorized("Loan")) {
         
            addSeparator();
            PluginHelper.add(this, "Loan");
        }

        addSeparator();

        JMenu menuAdmin = ComponentFactory.getMenu(IconLibrary._icoModuleTypeProperty16, DcResources.getText("lblAdministration"));
       
        Collection<DcPropertyModule> modules = new ArrayList<DcPropertyModule>();
        for (DcFieldDefinition definition : module.getFieldDefinitions().getDefinitions()) {
            DcField field = module.getField(definition.getIndex());
            DcPropertyModule pm = DcModules.getPropertyModule(field);
           
            if (pm != null && !modules.contains(pm))
                modules.add(pm);
        }

        for (DcModule pm : modules) {
            try {
                Plugin plugin = Plugins.getInstance().get("ManageItem", dco, null, viewIdx,  pm.getIndex());
                if (    plugin != null &&SecurityCentre.getInstance().getUser().isAuthorized(plugin) &&
                        UserMode.isCorrectXpLevel(plugin.getXpLevel())) {
                   
                    JMenuItem item = ComponentFactory.getMenuItem(plugin);
                    item.setEnabled(plugin.isEnabled());
                    item.setIcon(plugin.getIcon());
                   
                    menuAdmin.add(item);
                }
            } catch (InvalidPluginException e) {
                logger.error(e, e);
            }
        }
       
        if (menuAdmin.getItemCount() > 0)
            add(menuAdmin);
       
        addSeparator();
        PluginHelper.add(this, "ViewSettings");
       
View Full Code Here

Examples of javax.swing.JMenu

     * @return Component to use to control parameters for this EOMG.
     */
    public Component getGUI(GraphicAttributes graphicAttributes) {
        Debug.message("eomg", "EditableOMPoly.getGUI");
        if (graphicAttributes != null) {
            JMenu ahm = getArrowHeadMenu();
            graphicAttributes.setLineMenuAdditions(new JMenu[] { ahm });
            Component gaGUI = graphicAttributes.getGUI();
            ((JComponent) gaGUI).add(getPolyGUI());
            return gaGUI;
        } else {
View Full Code Here

Examples of javax.swing.JMenu

        return enableLineTypeChoice;
    }

    protected void setPreStrokeMenuOptions(JPopupMenu popup) {
        super.setPreStrokeMenuOptions(popup);
        JMenu ltm = getLineTypeMenu();
        if (ltm != null) {
            popup.add(ltm);
        }
    }
View Full Code Here

Examples of javax.swing.JMenu

            popup.add(ltm);
        }
    }

    public JMenu getLineTypeMenu() {
        JMenu lineTypeMenu = null;

        if (renderType == RENDERTYPE_LATLON && enableLineTypeChoice) {
            lineTypeMenu = new JMenu(i18n.get(GraphicAttributes.class,
                    "Line_Type",
                    "Line Type"));

            ActionListener listener = new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    String command = ae.getActionCommand();
                    try {
                        setLineType(Integer.parseInt(command));
                    } catch (NumberFormatException e) {
                    }
                }
            };

            ButtonGroup group = new ButtonGroup();
            JRadioButtonMenuItem button = new JRadioButtonMenuItem(i18n.get(DrawingAttributes.class,
                    "Great_Circle",
                    "Great Circle"), lineType == LineType.GreatCircle);
            button.setActionCommand(String.valueOf(LineType.GreatCircle));
            button.addActionListener(listener);
            lineTypeMenu.add(button);

            button = new JRadioButtonMenuItem(i18n.get(GraphicAttributes.class,
                    "Rhumb",
                    "Rhumb"), lineType == LineType.Rhumb);
            button.setActionCommand(String.valueOf(LineType.Rhumb));
            group.add(button);
            button.addActionListener(listener);
            lineTypeMenu.add(button);

            button = new JRadioButtonMenuItem(i18n.get(GraphicAttributes.class,
                    "Straight",
                    "Straight"), lineType == LineType.Straight);
            button.setActionCommand(String.valueOf(LineType.Straight));
            group.add(button);
            button.addActionListener(listener);
            lineTypeMenu.add(button);
        }
        return lineTypeMenu;
    }
View Full Code Here

Examples of javax.swing.JMenu

  protected JMenu createJMenu(final String base)
  {
    final String label = getResources().getString(base + ".name");
    final Integer mnemonic = getResources().getMnemonic(base + ".mnemonic");

    final JMenu menu = new JMenu(label);
    if (mnemonic != null)
    {
      menu.setMnemonic(mnemonic.intValue());
    }
    return menu;
  }
View Full Code Here

Examples of javax.swing.JMenu

   * @return the menu bar.
   */
  protected JMenuBar createMenuBar()
  {
    final JMenuBar mb = new JMenuBar();
    final JMenu fileMenu = createJMenu("menu.file");

    final JMenuItem previewItem = new ActionMenuItem(getPreviewAction());
    final JMenuItem exitItem = new ActionMenuItem(getCloseAction());

    fileMenu.add(previewItem);
    fileMenu.addSeparator();
    fileMenu.add(exitItem);
    mb.add(fileMenu);

    // then the help menu
    final JMenu helpMenu = createJMenu("menu.help");
    helpMenu.add(new ActionMenuItem(aboutAction));
    mb.add(helpMenu);
    return mb;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.