Examples of KeyEvent


Examples of java.awt.event.KeyEvent

            } else {
                source = top;
            }
        }

        KeyEvent ke = new KeyEvent(source, id, time, modifiers, keyCode, keyChar);

        JNodeToolkit.postToTarget(ke, source);
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

      final AbstractBar.AbstractComponentAction prevAction = new AbstractComponentAction("Previous Occurence", "Previous Occurence (Ctrl+F3)", KeyEvent.VK_F3, InputEvent.SHIFT_DOWN_MASK, KeyEvent.VK_F3) {
        private static final long serialVersionUID = 0L;


        public void actionPerformed(final ActionEvent e) {
          _popup.processKeyEvent(new KeyEvent(_prevButton, 401, System.currentTimeMillis(), InputEvent.SHIFT_DOWN_MASK, KeyEvent.VK_F3, KeyEvent.CHAR_UNDEFINED));
        }
      };
      _prevButton = new ToolBarButton(prevAction, _prevIcon);
      add(_prevButton);


      final AbstractBar.AbstractComponentAction nextAction = new AbstractComponentAction("Next Occurence", "Next Occurence (Ctrl+F3)", KeyEvent.VK_F3, 0, KeyEvent.VK_F3) {
        private static final long serialVersionUID = 0L;


        public void actionPerformed(final ActionEvent e) {
          _popup.processKeyEvent(new KeyEvent(_nextButton, 401, System.currentTimeMillis(), 0, KeyEvent.VK_F3, KeyEvent.CHAR_UNDEFINED));
        }
      };
      _nextButton = new ToolBarButton(nextAction, _nextIcon);
      add(_nextButton);
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

    if (content != null) {
      final ToolWindowPanel panel = (ToolWindowPanel) content.getComponent();
      final BugTree tree = panel.getBugTreePanel().getBugTree();
      tree.setSelectionRow(0);
      tree.requestFocusInWindow();
      tree.dispatchEvent(new KeyEvent(tree, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), KeyEvent.CTRL_DOWN_MASK, KeyEvent.VK_F, 'F'));
    }

  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    public void testProcessKeyEvent() throws Exception {
        comboBox.setKeySelectionManager(null);
        createVisibleComboBox();
        PopupMenuController pmc = new PopupMenuController();
        comboBox.addPopupMenuListener(pmc);
        KeyEvent event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        comboBox.setPopupVisible(true);
        assertNotNull(pmc.getEvent());
        assertEquals(PopupMenuController.VISIBLE, pmc.getEventType());
        pmc.reset();
        comboBox.addItem("a");
        comboBox.addItem("b");
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_B);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("b", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
        comboBox.processKeyEvent(event);
        assertNotNull(pmc.getEvent());
        assertEquals(PopupMenuController.INVISIBLE, pmc.getEventType());
        assertEquals("a", comboBox.getSelectedItem());
        comboBox.setKeySelectionManager(new JComboBox.KeySelectionManager() {
            public int selectionForKey(final char key, final ComboBoxModel model) {
                return -1;
            }
        });
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_B);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

                }
            }

            if (table.isEditing()) {
                e.consume();
                KeyEvent editorEvent = new KeyEvent(table.getEditorComponent(), e.getID(), e.getWhen(), e.getModifiers(), e.getKeyCode(), e.getKeyChar());
                table.getEditorComponent().dispatchEvent(editorEvent);
            }
        }
View Full Code Here

Examples of java.awt.event.KeyEvent

        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (!e.dispatchedByKFM && kfm.dispatchEvent(e)) {
            return;
        }
        if (e instanceof KeyEvent) {
            KeyEvent ke = (KeyEvent) e;
            // consumes KeyEvent which represents a focus traversal key
            if (getFocusTraversalKeysEnabled()) {
                kfm.processKeyEvent(this, ke);
                if (ke.isConsumed()) {
                    return;
                }
            }
        }
        if (inputMethodsEnabled && dispatchToIM && e.isPosted && dispatchEventToIM(e)) {
View Full Code Here

Examples of java.awt.event.KeyEvent

    public void testProcessKeyEvent() throws Exception {
        comboBox.setKeySelectionManager(null);
        createVisibleComboBox();
        PopupMenuController pmc = new PopupMenuController();
        comboBox.addPopupMenuListener(pmc);
        KeyEvent event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        comboBox.setPopupVisible(true);
        assertNotNull(pmc.getEvent());
        assertEquals(PopupMenuController.VISIBLE, pmc.getEventType());
        pmc.reset();
        comboBox.addItem("a");
        comboBox.addItem("b");
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_B);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("b", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
        comboBox.processKeyEvent(event);
        assertNotNull(pmc.getEvent());
        assertEquals(PopupMenuController.INVISIBLE, pmc.getEventType());
        assertEquals("a", comboBox.getSelectedItem());
        comboBox.setKeySelectionManager(new JComboBox.KeySelectionManager() {
            public int selectionForKey(final char key, final ComboBoxModel model) {
                return -1;
            }
        });
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_TAB);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_A);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
        pmc.reset();
        event = new KeyEvent(comboBox, KeyEvent.KEY_PRESSED, EventQueue
                .getMostRecentEventTime(), 0, KeyEvent.VK_B);
        comboBox.processKeyEvent(event);
        assertNull(pmc.getEvent());
        assertEquals("a", comboBox.getSelectedItem());
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

            @Override
            public void keyTyped(KeyEvent ke) {
                eventProcessed = true;
            }
        });
        tf.processEvent(new KeyEvent(tf, KeyEvent.KEY_TYPED,
                                           0, 0, 0, 's'));
        assertTrue(eventProcessed);
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

            @Override
            public void keyPressed(KeyEvent a0) {
                eventProcessed = true;
            }
        });
        textComp.processEvent(new KeyEvent(textComp, KeyEvent.KEY_PRESSED,
                                           0, 0, 0, 's'));
        assertTrue(eventProcessed);
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

    {
        if (source == null) return;
       
        long when = System.currentTimeMillis();

        KeyEvent keyEvent = new KeyEvent(source, KeyEvent.KEY_PRESSED, when, modifiers, key,
            KeyEvent.CHAR_UNDEFINED);

        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(keyEvent);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.