Package java.awt

Examples of java.awt.KeyEventDispatcher


            // Set the default on the Don's Save button
            pane.setInitialValue(dontSaveBtn);
            pane.selectInitialValue();
           
            // The key event dispatcher used to catch the mnemonics for the options (without ALT)
            final KeyEventDispatcher mnemonicKeyEventDispatcher = new KeyEventDispatcher() {
               
                public boolean dispatchKeyEvent(KeyEvent evt) {
                    // Only process the KEY_PRESSED events and ignore KEY_RELEASED and KEY_TYPED events for the same keystroke
                    // If the type check is not implemented, the GemcutterSaveDialog's dispatchKeyEvent will process a
                    // different event from the same key stroke.
View Full Code Here


        setModal(true);
        setResizable(false);
        setContentPane(getJDialogContentPane());

        // Add a key event dispatcher that will close this dialog when ESC is pressed.
        mnemonicsKeyEventDispatcher = new KeyEventDispatcher() {

            public boolean dispatchKeyEvent(KeyEvent evt) {
                // Only process the KEY_PRESSED events and ignore KEY_RELEASED and KEY_TYPED events for the same keystroke.
                // If the type check is not implemented, the GemcutterSaveDialog's dispatchKeyEvent will process another event
                // generated from a key stroke that has been dealt with already.
View Full Code Here

            }
        });

        // Add a key event dispatcher that will watch for ESC key events.
        cancelKeyEventDispatcher = new KeyEventDispatcher() {
           
            public boolean dispatchKeyEvent(java.awt.event.KeyEvent evt) {
               
                // Only worry if the event is an ESC key press (not release, etc) and the table is
                // not editing
View Full Code Here

    });
   
    // add keys listener to frame;
    // on linux and mac there is a problem with presed and release loop (will be solved);
      KeyboardFocusManager.getCurrentKeyboardFocusManager()
       .addKeyEventDispatcher(new KeyEventDispatcher(){
          public boolean dispatchKeyEvent(KeyEvent e){
            if(e.getID() == KeyEvent.KEY_PRESSED)
            {
              if(e.getKeyCode() == KeyEvent.VK_SHIFT ) editGraph.key_Shift_pressed=true;
              if(e.getKeyCode() == KeyEvent.VK_X ) editGraph.key_X_pressed=true;
            }
            return false;}});
   
      KeyboardFocusManager.getCurrentKeyboardFocusManager()
       .addKeyEventDispatcher(new KeyEventDispatcher(){
          public boolean dispatchKeyEvent(KeyEvent e){
            if(e.getID() == KeyEvent.KEY_RELEASED)
            {
              if(e.getKeyCode() == KeyEvent.VK_SHIFT ) editGraph.key_Shift_pressed=false;
              if(e.getKeyCode() == KeyEvent.VK_X ) editGraph.key_X_pressed=false;
View Full Code Here

        return recentMenu;
    }

    static void addStandardPreferencesShortcutOnMac() {
        if (UISupport.isMac()) {
            KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
                @Override
                public boolean dispatchKeyEvent(KeyEvent e) {
                    int modifiers = e.getModifiers();
                    if (e.getKeyChar() == ',' && (modifiers == InputEvent.META_DOWN_MASK || modifiers == InputEvent.META_MASK)) {
                        SoapUIPreferencesAction.getInstance().actionPerformed(new ActionEvent(frame, 1, "ShowPreferences"));
View Full Code Here

    private TextToSpeech speech = TextToSpeechFactory.getDefaultTextToSpeech();
   
    public void gainControl() {
        manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        manager.addKeyEventPostProcessor(this);
        manager.addKeyEventDispatcher(new KeyEventDispatcher() {

            public boolean dispatchKeyEvent(KeyEvent e) {
                long time = e.getWhen();
                if (e.getKeyCode() == KeyEvent.VK_DELETE
                        || e.getKeyCode() == KeyEvent.VK_BACK_SPACE
View Full Code Here

    this.view.add(scroll, gbc);
   
    gbc = new GridBagConstraints(0,1, 1,1, 1,0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0,0);
    this.view.add(this.locker.getView(), gbc);
    // level locker
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {         
      public boolean dispatchKeyEvent(KeyEvent e) {
        if(SearchTree.this.locker.getStation() == LevelLocker.DEF_LOCK) {
          if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_DOWN) {
            synchronized (SearchTree.this.theMutexObject) {
              if(SearchTree.this.currNode != null) {
View Full Code Here

        zoomIn();
      }
    });
    this.button.setEnabled(false);
    // ctrl + plus
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {         
      public boolean dispatchKeyEvent(KeyEvent e) {
        // if use VK_PLUS, that it's will not work, because JDK has bug with it.
        if (e.getID() == KeyEvent.KEY_PRESSED && (e.getKeyChar() == '+' || e.getKeyCode() == KeyEvent.VK_EQUALS) && e.isControlDown()) {
          zoomIn();
          return(true);
View Full Code Here

        zoomOut();
      }
    });
    this.button.setEnabled(false);
    // ctrl + minus
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {         
      public boolean dispatchKeyEvent(KeyEvent e) {
        // if use VK_MINUS, that it's will not work, because JDK has bug with it.
        if (e.getID() == KeyEvent.KEY_PRESSED && (e.getKeyChar() == '-' || e.getKeyCode() == KeyEvent.VK_MINUS) && e.isControlDown()) {
          zoomOut();
          return(true);
View Full Code Here

    protected void initialize() {
        /*
         * Initialize shortcut keys
         */
        FocusManager.getCurrentManager().addKeyEventDispatcher(new KeyEventDispatcher() {
            public boolean dispatchKeyEvent(KeyEvent e) {
                if (getShortcutKeys() != null && e.getID() == KeyEvent.KEY_PRESSED) {
                    for (ShortcutKey shortcutKey : getShortcutKeys()) {
                        if (shortcutKey.getModifiers() == e.getModifiers()) {
                            if (shortcutKey.getKeyCode() == e.getKeyCode()) {
View Full Code Here

TOP

Related Classes of java.awt.KeyEventDispatcher

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.