Package javax.swing

Examples of javax.swing.JPopupMenu$PopupMouseEventPreprocessor


    mDefaultAction = getCollapseExpandAction(path);
    mPath = path;
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem item = new JMenuItem(mDefaultAction);
    item.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
    menu.add(item);
    menu.add(getExpandAllMenuItem(mPath));
    menu.add(getFilterMenuItem(mPath));
    menu.add(getExportMenu( mPath));
    return menu;
  }
View Full Code Here


    setLayout(new BorderLayout());
    this.table = SystemPropertiesPanel.createSystemPropertiesTable();
    add(new JScrollPane(this.table));

    // Add a popup menu to copy to the clipboard...
    this.copyPopupMenu = new JPopupMenu();

    final String label = bundleSupport.getString("system-properties-panel.popup-menu.copy");
    final KeyStroke accelerator = bundleSupport.getKeyStroke("system-properties-panel.popup-menu.copy.accelerator");

    final JMenuItem copyMenuItem = new JMenuItem(label);
View Full Code Here

    protected boolean displayPopup(List contents, MouseEvent me) {
        if (DEBUG) {
            Debug.output("displayPopup(" + contents + ") " + me);
        }
        if (contents != null && contents.size() > 0) {
            JPopupMenu jpm = new JPopupMenu();
            Iterator it = contents.iterator();
            while (it.hasNext()) {
                Object obj = it.next();
                if (obj instanceof java.awt.Component) {
                    jpm.add((java.awt.Component) obj);
                }
            }
            jpm.show((java.awt.Component) me.getSource(), me.getX(), me.getY());
            return true;
        }
        return false;
    }
View Full Code Here

    /**
     * Builds the popup menu
    */
    private void setupPopupMenu() {
        popupMenu = new JPopupMenu();

        executeMenuItem = Utility.createMenuItem( this.getClass(), "Execute", EXECUTE_PNG, new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                executeSelectedTasks();
            }
View Full Code Here

    popupMenuInfo.setSupportsAnchor(false);
  };

  public PopupMenu(Widget parent, String name) throws GUIException {
    super(parent, name);
    popupMenu = new JPopupMenu();
  }
View Full Code Here

    }

    public JPopupMenu createPopupMenu() {

        OMGraphic g = getCurrentEditable().getGraphic();
        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) {
                        OMGraphic g = eomg.getGraphic();
                        if (g != null) {
                            notifyListener(g, action);
                        }
                    }
                    setCurrentEditable(null);
                    deactivate();
                }
            });
            pum.add(delete);
        }

        // JMenuItem reset = new JMenuItem("Undo Changes");
        // reset.setEnabled(false);
        // reset.addActionListener(new ActionListener() {
        // public void actionPerformed(ActionEvent ae) {
        // if (currentEditable != null) {
        // currentEditable.reset();
        // }
        // }
        // });

        // pum.add(reset);

        return pum.getComponentCount() > 0 ? pum : null;
    }
View Full Code Here

            launchButton = new JButton(icon);
            launchButton.setToolTipText(i18n.get(BasicStrokeEditorMenu.class, "Modify_Line_Parameters", "Modify Line Parameters"));
            launchButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    JButton button = getLaunchButton();
                    JPopupMenu popup = new JPopupMenu();
                    setGUI(popup);
                    popup.show(button, button.getWidth(), 0);
                }
            });
        }
        return launchButton;
    }
View Full Code Here

        dtde.dropComplete(true);

        if (transferData == null || dropLocation == null)
            return;

        JPopupMenu popup = new JPopupMenu();
        TitledBorder titledBorder = BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(),
                "Available Drop Targets:");

        titledBorder.setTitleColor(Color.gray);
        popup.setBorder(titledBorder);

        Border compoundborder = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
                BorderFactory.createEmptyBorder(2, 2, 2, 2));

        //
        // Check whether the dropped object is of type Location
        // (has exact x and y coordinates).
        //
        if (transferData instanceof Location) {
            ((Location) transferData).setLocation(dropLocation.x,
                    dropLocation.y,
                    proj);

            OMGraphicHandlerLayer omlayer = null;
            String layer_name;
            Enumeration keys = layers.keys();

            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));

        //
        // Show a popup menu of available drop targets.
        //
        popup.show(((DropTarget) dtde.getSource()).getComponent(),
                dropLocation.x,
                dropLocation.y);

    }
View Full Code Here

                "Modify Drawing Parameters"));

        lineButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                JButton button = getLineButton();
                JPopupMenu popup = new JPopupMenu();

                setPreStrokeMenuOptions(popup);
                setStrokeMenuOptions(popup);
                setPostStrokeMenuOptions(popup);

                popup.show(button, button.getWidth(), 0);
            }
        });

        toolbar.add(lineButton);
View Full Code Here

        addItemListener(this);
    }
   
    @Override
    public void addSeparator() {
        JPopupMenu menu = getPopupMenu();
        if (menu.getComponentCount() > 0) {
            Component[] c = menu.getComponents();
            if (c[c.length - 1] instanceof JMenuItem)
                super.addSeparator();
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.JPopupMenu$PopupMouseEventPreprocessor

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.