Package javax.swing

Examples of javax.swing.KeyStroke


    // 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);
    copyMenuItem.setAccelerator(accelerator);
    copyMenuItem.getAccessibleContext().setAccessibleDescription(label);
    copyMenuItem.addActionListener(new CopyAction());
View Full Code Here


    if (oldAction != null)
    {
      oldAction.removePropertyChangeListener(selectedHandler);
    }
    super.setAction(a);
    final KeyStroke ks = (a == null) ? null :
        (KeyStroke) a.getValue(Action.ACCELERATOR_KEY);
    setAccelerator(ks);

    if (a != null)
    {
View Full Code Here

      {
        setSelected(Boolean.TRUE.equals(evt.getNewValue()));
      }
      if (Action.ACCELERATOR_KEY.equals(evt.getPropertyName()))
      {
        final KeyStroke ks = (KeyStroke) evt.getNewValue();
        setAccelerator(ks);
      }
    }
View Full Code Here

    {
      getButton().setAction(null);
      final Object o = oldAction.getValue(Action.ACCELERATOR_KEY);
      if (o instanceof KeyStroke)
      {
        final KeyStroke k = (KeyStroke) o;
        getButton().unregisterKeyboardAction(k);
      }
      oldAction.removePropertyChangeListener(actionChangeHandler);
    }
  }
View Full Code Here

      newAction.addPropertyChangeListener(actionChangeHandler);

      final Object o = newAction.getValue(Action.ACCELERATOR_KEY);
      if (o instanceof KeyStroke)
      {
        final KeyStroke k = (KeyStroke) o;
        getButton().registerKeyboardAction(newAction, k, JComponent.WHEN_IN_FOCUSED_WINDOW);
      }

      if (newAction instanceof ToggleStateAction)
      {
View Full Code Here

        }

        if (propertyName.equals(Action.ACCELERATOR_KEY))
        {

          final KeyStroke oldVal = (KeyStroke) event.getOldValue();
          if (oldVal != null)
          {
            getButton().unregisterKeyboardAction(oldVal);
          }
          final Object o = actionImpl.getValue(Action.ACCELERATOR_KEY);
          if (o instanceof KeyStroke)
          {
            final KeyStroke k = (KeyStroke) o;
            getButton().registerKeyboardAction(actionImpl, k, JComponent.WHEN_IN_FOCUSED_WINDOW);
          }
        }
        else if (propertyName.equals(Action.MNEMONIC_KEY))
        {
View Full Code Here

      oldAction.removePropertyChangeListener(actionChangeHandler);

      final Object o = oldAction.getValue(Action.ACCELERATOR_KEY);
      if (o instanceof KeyStroke)
      {
        final KeyStroke k = (KeyStroke) o;
        menuitem.unregisterKeyboardAction(k);
      }
    }
  }
View Full Code Here

    if( editMarkerPane == null ) {
      final SpringPanel    spring;
      final ActionMap      amap;
      final InputMap      imap;
      JLabel          lb;
      KeyStroke        ks;
      Action          a;

      spring      = new SpringPanel( 4, 2, 4, 2 );
      ggMarkName    = new JTextField( 24 );
//      GUIUtil.setInitialDialogFocus( ggMarkName );  // removes itself automatically
View Full Code Here

        map.put(ACTION_REDO, new Actions(ACTION_REDO));
        map.put(ACTION_CUT, new Actions(ACTION_CUT));
        map.put(ACTION_COPY, new Actions(ACTION_COPY));
        map.put(ACTION_PASTE, new Actions(ACTION_PASTE));
       
        KeyStroke findStroke = SearchFactory.getInstance().getSearchAccelerator();
        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(findStroke, "find");
    }
View Full Code Here

        if (w instanceof JFrame) {
            final JFrame f = (JFrame)w;
            f.getRootPane().setDefaultButton(closeButton);
            f.setResizable(true);
            f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
            f.getRootPane().registerKeyboardAction(closeAction, ks, JComponent.WHEN_IN_FOCUSED_WINDOW);
        } else if (w instanceof JDialog) {
            final JDialog d = (JDialog)w;
            d.getRootPane().setDefaultButton(closeButton);
            d.setResizable(true);
            d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
            KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
            d.getRootPane().registerKeyboardAction(closeAction, ks, JComponent.WHEN_IN_FOCUSED_WINDOW);
        }

        w.addWindowListener(new WindowAdapter() {
            @Override
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.