Package javax.swing

Examples of javax.swing.JMenuItem


        JPopupMenu pum = new JPopupMenu();

        if ((g.getAttribute(OMGraphicConstants.CHANGE_APPEARANCE)) == null
                || ((Boolean) g.getAttribute(OMGraphicConstants.CHANGE_APPEARANCE)).booleanValue()) {

            JMenuItem gui = new JMenuItem(i18n.get(OMDrawingTool.class,
                    "popupMenuChangeAppearance",
                    "Change Appearance"));
            gui.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    EditableOMGraphic eomg = getCurrentEditable();
                    if (eomg != null) {
                        boolean previous = eomg.getShowGUI();
                        eomg.setShowGUI(true);
                        setVisible(true);
                        if (!getUseAsTool()) {
                            showInWindow();
                        }
                        eomg.setShowGUI(previous);
                        eomg.getStateMachine().setSelected();
                    }
                }
            });
            if (isMask(SHOW_GUI_BEHAVIOR_MASK | GUI_VIA_POPUP_BEHAVIOR_MASK)
                    && !getUseAsTool()) {
                pum.add(gui);
            } else {
                Debug.output("Not adding Change Appearance to popup: guiViaPopup("
                        + isMask(SHOW_GUI_BEHAVIOR_MASK)
                        + ") isTool("
                        + getUseAsTool() + ")");
            }
        }

        if ((g.getAttribute(OMGraphicConstants.REMOVABLE)) == null
                || ((Boolean) g.getAttribute(OMGraphicConstants.REMOVABLE)).booleanValue()) {

            JMenuItem delete = new JMenuItem(i18n.get(OMDrawingTool.class,
                    "popupMenuDelete",
                    "Delete"));
            delete.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    OMAction action = new OMAction();
                    action.setMask(OMGraphic.DELETE_GRAPHIC_MASK);
                    EditableOMGraphic eomg = getCurrentEditable();
                    if (eomg != null) {
View Full Code Here


        String newProjClassName = projection.getClass().getName();

        // Change the selected projection type menu item
        for (int i = 0; i < getItemCount(); i++) {
            JMenuItem item = getItem(i);
            if (newProjClassName.equals(item.getName())) {
                if (Debug.debugging("projectionmenu")) {
                    Debug.output("ProjectionMenu | setting " + item.getName()
                            + " as active");
                }
                item.setSelected(true);
                return;
            }
        }
    }
View Full Code Here

  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);
View Full Code Here

        private void initialize() {

          if( PersistenceManager.isPersistenceEnabled() ) {
            changePriorityMenu = new JMenu();
            for(final FreenetPriority priority : FreenetPriority.values()) {
              JMenuItem priorityMenuItem = new JMenuItem();
              priorityMenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(final ActionEvent actionEvent) {
                  changeItemPriorites(modelTable.getSelectedItems(), priority);
                }
              });
              changePriorityMenu.add(priorityMenuItem);
            }

            removeFromGqItem = new JMenuItem();
            removeFromGqItem.addActionListener(this);
          }

            refreshLanguage();
View Full Code Here

     *
     * @param lp the LayersPanel to ask for an ActionListener from.
     */
    public void setupEditLayersButton(LayersPanel lp) {
        // initalize the Edit Layers... button.
        JMenuItem button = new JMenuItem(i18n.get(LayersMenu.class,
                "editLayersButtonTitle",
                editLayersButtonTitle));
        button.setActionCommand("edit");
        button.addActionListener(lp.getActionListener());
        setEdit(button);
        setLayersPanel(lp);
    }
View Full Code Here

     * Constructs the menu item that will bring up the LayerAddPanel.
     */
    public void setupLayerAddButton(final LayerAddPanel menu) {
        final LayerAddPanel lap = menu;
        // JMenuItem button = new JMenuItem(addLayersButtonTitle);
        JMenuItem button = new JMenuItem(i18n.get(LayersMenu.class,
                "addLayersButtonTitle",
                addLayersButtonTitle));
        button.setActionCommand("add");
        button.addActionListener(lap);
        setAdd(button);
        add(button);
    }
View Full Code Here

        dbvmi.findAndInit(getBeanContext());
        dataBoundsMenu.add(dbvmi);
    }

    public void removeDataBoundsProvider(DataBoundsProvider provider) {
        JMenuItem item = (DataBoundsViewMenuItem) dataBoundsProviders.get(provider);
        if (item != null) {
            dataBoundsProviders.remove(provider);
            dataBoundsMenu.remove(item);
        }
    }
View Full Code Here

    public void actionPerformed(java.awt.event.ActionEvent e) {
        Object source = e.getSource();
        if (!(source instanceof JMenuItem))
            return;

        JMenuItem mi = (JMenuItem) source;
        String name = mi.getText();
        OMGraphicHandlerLayer targetLayer = (OMGraphicHandlerLayer) layers.get(name);

        if (targetLayer == null) {
            Debug.message("defaultdndcatcher",
                    "ERROR> DefaultDnDCatcher::actionPerformed: "
View Full Code Here

            while (keys.hasMoreElements()) {
                layer_name = keys.nextElement().toString();
                omlayer = (OMGraphicHandlerLayer) layers.get(layer_name);

                if (omlayer.isVisible()) {
                    JMenuItem menuItem = new JMenuItem(layer_name);
                    menuItem.setHorizontalTextPosition(SwingConstants.CENTER);
                    menuItem.setBorder(compoundborder);
                    menuItem.addActionListener(this);
                    popup.add(menuItem);
                }
            }

            popup.addSeparator();
        }

        JMenuItem menuItem = new JMenuItem("CANCEL");
        menuItem.setForeground(Color.red);
        menuItem.setHorizontalTextPosition(SwingConstants.CENTER);
        menuItem.setBorder(compoundborder);

        popup.add(menuItem);

        popup.setPreferredSize(new Dimension(150, (popup.getComponentCount() + 1) * 25));

 
View Full Code Here

            // lineColorButton = new JButton(getIconForPaint(getLinePaint(),
            // false));
            interString = i18n.get(DrawingAttributes.class,
                    "lineColorItem",
                    "Change Edge Color");
            lineColorItem = new JMenuItem(interString);
            lineColorItem.setActionCommand(LineColorCommand);
            lineColorItem.addActionListener(this);
            interString = i18n.get(DrawingAttributes.class,
                    "lineColorItem",
                    I18n.TOOLTIP,
                    "Change edge color for rendering.");
            lineColorItem.setToolTipText(interString);
        }

        if (fillColorItem != null) {
            // fillColorButton.setIcon(getIconForPaint(getFillPaint(), true));
        } else {
            // fillColorButton = new JButton(getIconForPaint(getFillPaint(),
            // true));
            interString = i18n.get(DrawingAttributes.class,
                    "fillColorItem",
                    "Change Fill Color");
            fillColorItem = new JMenuItem(interString);
            fillColorItem.setActionCommand(FillColorCommand);
            fillColorItem.addActionListener(this);
            interString = i18n.get(DrawingAttributes.class,
                    "fillColorItem",
                    I18n.TOOLTIP,
                    "Change fill color for rendering.");
            fillColorItem.setToolTipText(interString);
        }

        if (selectColorItem != null) {
            // selectColorButton.setIcon(getIconForPaint(getSelectPaint(),
            // false));
        } else {
            // selectColorButton = new JButton(getIconForPaint(getSelectPaint(),
            // false));
            interString = i18n.get(DrawingAttributes.class,
                    "selectColorItem",
                    "Change Highlight Edge Color");
            selectColorItem = new JMenuItem(interString);
            selectColorItem.setActionCommand(SelectColorCommand);
            selectColorItem.addActionListener(this);
            interString = i18n.get(DrawingAttributes.class,
                    "selectColorItem",
                    I18n.TOOLTIP,
                    "Change highlight edge color rendered during selection.");
            selectColorItem.setToolTipText(interString);
        }

        if (mattingColorItem != null) {
            // mattingColorButton.setIcon(getMattingIconForPaint());
        } else {
            // mattingColorButton = new JButton(getMattingIconForPaint());
            interString = i18n.get(DrawingAttributes.class,
                    "mattingColorItem",
                    "Change Matted Edge Color");
            mattingColorItem = new JMenuItem(interString);
            mattingColorItem.setActionCommand(MattingColorCommand);
            mattingColorItem.addActionListener(this);
            interString = i18n.get(DrawingAttributes.class,
                    "mattingColorItem",
                    I18n.TOOLTIP,
View Full Code Here

TOP

Related Classes of javax.swing.JMenuItem

Copyright © 2018 www.massapicom. 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.