Package javax.swing

Examples of javax.swing.KeyStroke


        getRootNode().putChild(IDENT, node);
    }

    public static void installAutoTabAction(JTextComponent tComp) {
        tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
        KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
        tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
    }
View Full Code Here


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

    // Sets keystroke component of currently selected entry
    private void setShortcut(KeyEvent event)
    {
        if (this.chooser.isBindingSelected())
        {
            KeyStroke input = KeyStroke.getKeyStrokeForEvent(event);

            if (this.isDisablingEnabled
                && input.getKeyCode() == this.disablingKeyCode)
            {
                String action = this.chooser.getSelected().getAction();
                if (this.chooser.getBindings().contains(
                    new BindingEntry(BindingEntry.DISABLED, action)))
                {
View Full Code Here

                    ex.printStackTrace();
                }
            }
        }
        if (key != -1) {
            KeyStroke ks = KeyStroke.getKeyStroke(key, mod);
            return ks;
        }
        return null;

    }
View Full Code Here

    // As the applet has no menu, activate accelerators directly on home view
    for (HomeView.ActionType actionType : HomeView.ActionType.values()) {
      Action action = homeView.getActionMap().get(actionType);
      if (action != null) {
        ResourceAction.MenuItemAction menuAction = new ResourceAction.MenuItemAction(action);
        KeyStroke accelerator = (KeyStroke)menuAction.getValue(Action.ACCELERATOR_KEY);
        if (accelerator != null) {
          homeView.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(accelerator, actionType);
        }
      }
    }
View Full Code Here

      actionMap.put(moveSelRightAction, new MoveSelectionAction(1));
      actionMap.put(SelectAllAction.SELECT_ALL, new SelectAllAction());

      final InputMap inputMap
        = panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
      final KeyStroke up = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0);
      inputMap.put(up, moveSelUpAction);
      final KeyStroke kpUp = KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, 0);
      inputMap.put(kpUp, moveSelUpAction);
      final KeyStroke down = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0);
      inputMap.put(down, moveSelDownAction);
      final KeyStroke kpDown = KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0);
      inputMap.put(kpDown, moveSelDownAction);
      final KeyStroke left = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0);
      inputMap.put(left, moveSelLeftAction);
      final KeyStroke kpLeft = KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0);
      inputMap.put(kpLeft, moveSelLeftAction);
      final KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
      inputMap.put(right, moveSelRightAction);
      final KeyStroke kpRight = KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0);
      inputMap.put(kpRight, moveSelRightAction);

      final int mask = getToolkit().getMenuShortcutKeyMask();
      final KeyStroke ctrlA = KeyStroke.getKeyStroke(KeyEvent.VK_A, mask);
      inputMap.put(ctrlA, SelectAllAction.SELECT_ALL);

      contextPopupMenu = new JPopupMenu();

      ButtonGroup       group         = new ButtonGroup();
View Full Code Here

    if (componentID != null && vars.getProperty(componentID, "") != "") {
      Vector keys = vars.getPropertyAsVector(componentID, "");
      for (int i = 0; i < keys.size(); i++) {
  String keyID = componentID + "." + (String)keys.elementAt(i);
  String keyAction = vars.getProperty(keyID + ".Action" , "");
  KeyStroke keyStroke = getKeyStroke(keyID, vars);
  if (keyAction != "" && keyStroke != null) {
    putInKeyTable(keyAction, keyStroke);
  }
      }
    }
View Full Code Here

    while (hashKeys.hasMoreElements()) {
      String actionCmd = (String)hashKeys.nextElement();
      Vector keyStrokeVector = getFromKeyTable(actionCmd);
      Action a = getAction(actionCmd);
      for (int i = 0; keyStrokeVector != null && i < keyStrokeVector.size(); i++) {
  KeyStroke keyStroke = (KeyStroke)keyStrokeVector.elementAt(i);
  inputMap.remove(keyStroke);
  actionMap.remove(actionCmd);
  if (a != null) {
    inputMap.put(keyStroke, actionCmd);
    actionMap.put(actionCmd, a);
View Full Code Here

   * @param defaultModifier swing default modifier key for the action
   * @param nativeModifier native modifier key for the action
   */
  private void remapKey(InputMapUIResource map, int key, int defaultModifier,
      int nativeModifier) {
    KeyStroke defaultKey = KeyStroke.getKeyStroke(key, defaultModifier);
    Object action = map.get(defaultKey);
   
    KeyStroke nativeKey = KeyStroke.getKeyStroke(key, nativeModifier);
    if (!nativeKey.equals(defaultKey)) {
      map.remove(defaultKey);
      map.put(nativeKey, action);
    }
  }
View Full Code Here

   */
  private void addToMainTableKeyBindings(Action action) {
    if (action != null) {
      Object keyStroke = action.getValue(Action.ACCELERATOR_KEY);
      if (keyStroke != null) {
        KeyStroke stroke = (KeyStroke) keyStroke;
        mainTable.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(stroke, action.getValue(Action.NAME));
        mainTable.getActionMap().put(action.getValue(Action.NAME), action);
      }
    }
  }
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.