Package javax.swing

Examples of javax.swing.KeyStroke


    }
    else{
      res.setMnemonic(iname.charAt(0));
    }

    KeyStroke k = getKeyStroke(name+"Shortcut");
    if (k != null) res.setAccelerator(k);

    if(listener!=null){
      res.addActionListener(listener);
    }
View Full Code Here


      res.setMnemonic(mname.charAt(0));
    } else {
      res.setMnemonic(iname.charAt(0));
    }

    KeyStroke k = getKeyStroke(name+"Shortcut");
    if (k != null) res.setAccelerator(k);

    if (listener != null) {
      res.addActionListener(listener);
    }
View Full Code Here

        }

        jmWindows = desktopCardPanel.createMenu(null);

        JMenuItem item = jmWindows.add(aZoomIn);
        KeyStroke  k = resources.getKeyStroke("zoomInShortcut");
        if (k != null) {
            item.setAccelerator(k);
        }
        item = jmWindows.add(aZoomOut);
        k = resources.getKeyStroke("zoomOutShortcut");
View Full Code Here

     * Add an edit menu to a menu bar1999
     */
    public void addEditMenu(Object mb) {
        jmEdit = resources.getMenu("edit");
        JMenuItem item;
        KeyStroke k;
        jmEdit.add(miUndo = resources.getItem("undo", this));
        k = resources.getKeyStroke("undoShortcut");
        miUndo.setIcon(resources.getIcon("undoImage"));
        if (k != null) {
            miUndo.setAccelerator(k);
View Full Code Here

        _rootNode.refresh();
        setTransferHandler(new ShapeTransferHandler());
        setDragEnabled(true);

        // register keyboard actions
        KeyStroke ks;
        ks=KeyStroke.getKeyStroke(KeyEvent.VK_Z,
                KeyEvent.CTRL_MASK);
        registerKeyboardAction(this, "z",
                ks, WHEN_FOCUSED);
        ks=KeyStroke.getKeyStroke(KeyEvent.VK_Y,
View Full Code Here

                    + "Action"));
            ImageIcon i = sharedResources.getIcon(_resourceKey + "Image");
            if (i != null) {
                putValue(Action.SMALL_ICON, i);
            }
            KeyStroke k = sharedResources.getKeyStroke(_resourceKey + "Shortcut");
            if (k != null) {
                putValue(Action.ACCELERATOR_KEY, k);
            }
            String tip = sharedResources.getStringValue(_resourceKey + "Tip");
            putValue(Action.SHORT_DESCRIPTION, tip);
View Full Code Here

                + "Text"));
        ImageIcon i = Tree.resources.getIcon(_resourceKey + "Image");
        if (i != null) {
            putValue(Action.SMALL_ICON, i);
        }
        KeyStroke k = Tree.resources.getKeyStroke(_resourceKey + "Shortcut");
        if (k != null) {
            putValue(Action.ACCELERATOR_KEY, k);
        }
        String tip = Tree.resources.getStringValue(_resourceKey + "Tip");
        putValue(Action.SHORT_DESCRIPTION, tip);
View Full Code Here

         {
            setVisible(false);
            dispose();
         }
      };
      KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
      getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(escapeStroke, "CloseAction");
      getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeStroke, "CloseAction");
      getRootPane().getInputMap(JComponent.WHEN_FOCUSED).put(escapeStroke, "CloseAction");
      getRootPane().getActionMap().put("CloseAction", closeAction);
View Full Code Here

         public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
            dispose();
         }
      };
      KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
      getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                   .put(escapeStroke, "CloseAction");
      getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
                   .put(escapeStroke, "CloseAction");
      getRootPane().getInputMap(JComponent.WHEN_FOCUSED).put(escapeStroke,
View Full Code Here

        doc.addDocumentListener(undoAction);
        doc.addDocumentListener(redoAction);

        InputMap im = textEditor.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
        KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK, false);
        im.put(ks, StructuredSyntaxResources.UNDO);
        ActionMap am = textEditor.getActionMap();
        am.put(StructuredSyntaxResources.UNDO, undoAction);

        ks = KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK, false);
View Full Code Here

TOP

Related Classes of javax.swing.KeyStroke

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.