Package javax.swing

Examples of javax.swing.AbstractAction


        // Keyboard action on the image viewer

        // full / normal view
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "esc");
        getActionMap().put("esc", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                Main.m_mainFrame.toggleView();
            }
        })

        // Zoom in / out
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_DOWN_MASK), "ctrl_+");
        getActionMap().put("ctrl_+", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                setZoomUp();
            }
        });
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_DOWN_MASK), "ctrl_-");
        getActionMap().put("ctrl_-", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                setZoomDown();
            }
        })
        // fit
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK), "ctrl_enter");
        getActionMap().put("ctrl_enter", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                resetZoom();
            }
        });

        // 100%
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_MULTIPLY, InputEvent.CTRL_DOWN_MASK), "ctrl_100%");
        getActionMap().put("ctrl_100%", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                setZoom(1.0f);
            }
        });

        // 50%
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DIVIDE, InputEvent.CTRL_DOWN_MASK), "ctrl_50%");
        getActionMap().put("ctrl_50%", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                setZoom(.5f);
            }
        });

        // Scrolling
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD2, 0), "ctrl_scrolldown");
        getActionMap().put("ctrl_scrolldown", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(0, Main.m_settings.getImgScrollDelta());
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD8, 0), "ctrl_scrollup");
        getActionMap().put("ctrl_scrollup", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(0, -Main.m_settings.getImgScrollDelta());
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, 0), "ctrl_scrollleft");
        getActionMap().put("ctrl_scrollleft", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(-Main.m_settings.getImgScrollDelta(), 0);
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD6, 0), "ctrl_scrollright");
        getActionMap().put("ctrl_scrollright", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(Main.m_settings.getImgScrollDelta(), 0);
            }
        });

        // diagonal
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD7, 0), "ctrl_scrollupleft");
        getActionMap().put("ctrl_scrollupleft", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(-Main.m_settings.getImgScrollDelta(), -Main.m_settings.getImgScrollDelta());
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD9, 0), "ctrl_scrollupright");
        getActionMap().put("ctrl_scrollupright", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(Main.m_settings.getImgScrollDelta(), -Main.m_settings.getImgScrollDelta());
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD1, 0), "ctrl_scrolldownleft");
        getActionMap().put("ctrl_scrolldownleft", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(-Main.m_settings.getImgScrollDelta(), Main.m_settings.getImgScrollDelta());
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD3, 0), "ctrl_scrolldownright");
        getActionMap().put("ctrl_scrolldownright", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    scrollImg(Main.m_settings.getImgScrollDelta(), Main.m_settings.getImgScrollDelta());
            }
        });

        // special
        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD5, 0), "ctrl_scrollcenter");
        getActionMap().put("ctrl_scrollcenter", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                {
                    Dimension size = getSize();
                    JViewport viewPort = (JViewport)getParent();
                    assert viewPort != null;
                    Dimension dimView = viewPort.getExtentSize();
                    setViewPosition(new Point((int)(size.width/2 - dimView.width/2), (int)(size.height/2 - dimView.height)));
                }
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD0, 0), "ctrl_scrollhome");
        getActionMap().put("ctrl_scrollhome", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                    setViewPosition(new Point(0, 0));
            }
        });

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DECIMAL, 0), "ctrl_scrollend");
        getActionMap().put("ctrl_scrollend", new AbstractAction()
        {
            public void actionPerformed(ActionEvent event)
            {
                if (m_zoom != 0.0f)
                {
View Full Code Here


        m_okCancelPanel.setBorder(BorderFactory.createEmptyBorder(topSpace, 0, 10, 10));
        m_okCancelPanel.add(Box.createHorizontalGlue());
        if (applyStr != null)
        {
            JButton apply = new JButton(applyStr);
            m_applyAction = new AbstractAction()
            {
                public void actionPerformed(ActionEvent ev)
                {
                    doApply();
                }
            };
            apply.addActionListener(m_applyAction);
            Dimension dim = apply.getPreferredSize();
            apply.setPreferredSize(new Dimension(100, (int)dim.getHeight()));
            m_okCancelPanel.add(apply);
            m_okCancelPanel.add(Box.createRigidArea(new Dimension(5, 0)));
        }
        if (okStr != null && cancelStr != null)
        {
            JButton ok = new JButton(okStr);
            ok.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent ev)
                {
                    if (doGetData())
                    {
                        m_bOk = true;
                        dispose();
                    }
                }
            });
            getRootPane().setDefaultButton(ok);
            Dimension dim = ok.getPreferredSize();
            ok.setPreferredSize(new Dimension(100, (int)dim.getHeight()));
            m_okCancelPanel.add(ok);
            m_okCancelPanel.add(Box.createRigidArea(new Dimension(5, 0)));
            JButton cancel = new JButton(cancelStr);
            m_cancelAction = new AbstractAction()
            {
                public void actionPerformed(ActionEvent ev)
                {
                    dispose();
                }
            };
            cancel.addActionListener(m_cancelAction);
            cancel.setPreferredSize(ok.getPreferredSize());
            m_okCancelPanel.add(cancel);

            InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
            inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "ESCAPE");
            getRootPane().getActionMap().put("ESCAPE", m_cancelAction);
        }
        else if (okStr != null)
        {
            JButton ok = new JButton(okStr);
            ok.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent ev)
                {
                    if (doGetData())
                    {
                        m_bOk = true;
                        dispose();
                    }
                }
            });
            getRootPane().setDefaultButton(ok);
            Dimension dim = ok.getPreferredSize();
            ok.setPreferredSize(new Dimension(100, (int)dim.getHeight()));
            m_okCancelPanel.add(ok);
        }
        else if (cancelStr != null)
        {
            JButton cancel = new JButton(cancelStr);
            m_cancelAction = new AbstractAction()
            {
                public void actionPerformed(ActionEvent ev)
                {
                    dispose();
                }
View Full Code Here

//            }

            JPopupMenu popup = new JPopupMenu();
            JMenuItem showSourcesItem = new JMenuItem("Display sources", Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.CODE));
            showSourcesItem.setFont(new java.awt.Font("Dialog", 0, 11));
            showSourcesItem.addActionListener(new AbstractAction() {
               
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
                    //AjdeUIManager.getDefault().getViewManager().showSourcesNodes(signatures);
                    // USED THE FOLLOWING FROM: BrowserViewManager:
//          public void showSourcesNodes(java.util.List nodes) {
//            for (Iterator it = nodes.iterator(); it.hasNext(); ) {
//              ProgramElementNode currNode = null;
//              IProgramElement IProgramElement = (IProgramElement)it.next();
//              if (IProgramElement instanceof LinkNode) {
//                currNode = ((LinkNode)IProgramElement).getProgramElementNode();
//              } else {
//                currNode = (ProgramElementNode)IProgramElement;
//              }
//              ISourceLocation sourceLoc = currNode.getSourceLocation();
//              if (null != sourceLoc) {
//                Ajde.getDefault().getEditorManager().addViewForSourceLine(
//                  sourceLoc.getSourceFile().getAbsolutePath(),
//                  sourceLoc.getLine());
//              }
//            }
//          }

                }
            });
            popup.add(showSourcesItem);

            popup.addSeparator();
            JMenuItem generatePCD = new JMenuItem("Pointcut Wizard (alpha)...", Ajde.getDefault().getIconRegistry().getStructureSwingIcon(IProgramElement.Kind.POINTCUT));
            generatePCD.setFont(new java.awt.Font("Dialog", 0, 11));
            generatePCD.addActionListener(new AbstractAction() {
               
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
          Ajde.getDefault().getViewManager().extractAndInsertSignatures(signatures, true);
View Full Code Here

    @Override
    public JMenuItem getMenuPresenter() {
        for (final ExporterClassUI ui : Lookup.getDefault().lookupAll(ExporterClassUI.class)) {
            String menuName = ui.getName();
            JMenuItem menuItem = new JMenuItem(new AbstractAction(menuName) {

                public void actionPerformed(ActionEvent e) {
                    ui.action();
                }
            });
View Full Code Here

        KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        Object actionKey = "cancel"; // NOI18N
        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey);

        Action cancelAction = new AbstractAction() {

            public void actionPerformed(ActionEvent ev) {
                cancel();
            }
        };
View Full Code Here

        XBayaLabel passLabel = new XBayaLabel("Password", this.usernameTextField);
        this.newUserButton = new XBayaLinkButton("Create new user...");
        newUserButton.setHorizontalAlignment(XBayaLinkButton.RIGHT);
        JLabel emptyLabel = new JLabel("");

        newUserButton.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                createNewUser();
            }
        });

        GridPanel infoPanel = new GridPanel();
        infoPanel.add(urlLabel);
        infoPanel.add(this.urlTextField);
        infoPanel.add(gatewayLabel);
        infoPanel.add(this.gatewayTextField);
        infoPanel.add(nameLabel);
        infoPanel.add(this.usernameTextField);
        infoPanel.add(passLabel);
        infoPanel.add(this.passwordTextField);
        infoPanel.add(emptyLabel);
        infoPanel.add(this.newUserButton);
        infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
//        infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);

        infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());

        JButton okButton = new JButton("OK");
        okButton.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                ok();
            }
        });

        JButton cancelButton = new JButton("Cancel");
        cancelButton.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                hide();
            }
        });
View Full Code Here

        mainPanel.add(this.list);
        mainPanel.layout(1, 1, 0, 0);

        JPanel buttonPanel = new JPanel();
        this.okButton = new JButton("Load");
        this.okButton.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                ok();
            }
        });
        buttonPanel.add(this.okButton);

        this.deleteButton = new JButton("Delete");
        this.deleteButton.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                delete();
            }
        });
        buttonPanel.add(this.deleteButton);

        JButton cancelButton = new JButton("Cancel");
        cancelButton.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                hide();
            }
        });
        buttonPanel.add(cancelButton);
View Full Code Here

    }

    private void createConfigureRegistryItem() {
        this.configureRegistryItem = new JMenuItem("Configure Registry");
        configureRegistryItem.setMnemonic(KeyEvent.VK_C);
        configureRegistryItem.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                XBayaEngine xbayaEngine = ExperimentMenu.this.engine;
                XBayaUtil.updateJCRRegistryInfo(xbayaEngine);
            }
        });
View Full Code Here

        });
    }

    private void createDeleteWorkflowtoRegistryItem() {
        this.deleteWorkflowfromRegistryItem = new JMenuItem("Delete Workflows in Registry");
        this.deleteWorkflowfromRegistryItem.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                try {
                    ExperimentMenu.this.registryAccesser.deleteOGCEWorkflow(ExperimentMenu.this.engine.getGUI().getWorkflow()
                            .getQname());
                } catch (AiravataAPIInvocationException e1) {
View Full Code Here

    private void createNodePopupMenu() {
        this.nodePopup = new JPopupMenu();
        if (editable) {
      JMenuItem deleteItem = new JMenuItem("Delete");
      deleteItem.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent event) {
          try {
            removeSelectedNode();
          } catch (GraphException e) {
            // Should not happen
            logger.error(e.getMessage(), e);
            GraphCanvas.this.engine.getGUI().getErrorWindow()
                .error(ErrorMessages.UNEXPECTED_ERROR, e);
          } catch (RuntimeException e) {
            logger.error(e.getMessage(), e);
            GraphCanvas.this.engine.getGUI().getErrorWindow()
                .error(ErrorMessages.UNEXPECTED_ERROR, e);
          } catch (Error e) {
            logger.error(e.getMessage(), e);
            GraphCanvas.this.engine.getGUI().getErrorWindow()
                .error(ErrorMessages.UNEXPECTED_ERROR, e);
          }

        }
      });
      this.nodePopup.add(deleteItem);
    }
    rerunItem = new JMenuItem("ReRun");
        rerunItem.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent event) {
                try {
                    rerunSelectedNode();
                } catch (RuntimeException e) {
                    logger.error(e.getMessage(), e);
                    GraphCanvas.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
                } catch (Error e) {
                    logger.error(e.getMessage(), e);
                    GraphCanvas.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
                }

            }
        });

        breakPointItem = new JMenuItem("Add break Point");
        breakPointItem.addActionListener(new AbstractAction() {
            public void actionPerformed(ActionEvent event) {
                try {
                    toggleBreakPointToNode();
                } catch (RuntimeException e) {
                    logger.error(e.getMessage(), e);
View Full Code Here

TOP

Related Classes of javax.swing.AbstractAction

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.