Java Code Examples for java.awt.event.KeyEvent#VK_PAGE_DOWN
The following examples show how to use
java.awt.event.KeyEvent#VK_PAGE_DOWN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqueakKeyboard.java From trufflesqueak with MIT License | 8 votes |
private static int mapSpecialKeyCode(final KeyEvent e) { //@formatter:off switch(e.getExtendedKeyCode()) { case KeyEvent.VK_BACK_SPACE: return 8; case KeyEvent.VK_TAB: return 9; case KeyEvent.VK_ENTER: return 13; case KeyEvent.VK_ESCAPE: return 27; case KeyEvent.VK_SPACE: return 32; case KeyEvent.VK_PAGE_UP: return 11; case KeyEvent.VK_PAGE_DOWN: return 12; case KeyEvent.VK_END: return 4; case KeyEvent.VK_HOME: return 1; case KeyEvent.VK_LEFT: return 28; case KeyEvent.VK_UP: return 30; case KeyEvent.VK_RIGHT: return 29; case KeyEvent.VK_DOWN: return 31; case KeyEvent.VK_INSERT: return 5; case KeyEvent.VK_DELETE: return 127; default: return -1; // Not a special key. } //@formatter:on }
Example 2
Source File: DefaultInteractionEventHandler.java From constellation with Apache License 2.0 | 6 votes |
/** * Respond to a key press event on the graph. This will respond to keys that * interact directly with the graph's visuals, such as W,A,S,D to pan. Most * key presses in CONSTELLATION, for example Ctrl+A, will be picked up by * the netbeans framework and cause plugins to be executed. * <p> * This is called continually whenever a key is held down (at the key repeat * rate of the operating system). * * @param event The KeyEvent related to the key press. */ @Override public void keyPressed(final KeyEvent event) { final int keyCode = event.getKeyCode(); // Avoid the control key so we don't interfere with ^S for save, for example. final boolean isCtrl = event.isControlDown(); final boolean isShift = event.isShiftDown(); if (keyCode == KeyEvent.VK_PAGE_UP || keyCode == KeyEvent.VK_PAGE_DOWN || (!isCtrl && (keyCode == KeyEvent.VK_A || keyCode == KeyEvent.VK_D || keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_W))) { queue.add(wg -> { if (wg != null) { final Camera camera = new Camera(VisualGraphUtilities.getCamera(wg)); if (keyCode == KeyEvent.VK_PAGE_UP) { CameraUtilities.changeMixRatio(camera, true, isCtrl); eventState.addEventName(MIX_ACTION_NAME); } else if (keyCode == KeyEvent.VK_PAGE_DOWN) { CameraUtilities.changeMixRatio(camera, false, isCtrl); eventState.addEventName(MIX_ACTION_NAME); } else if (keyCode == KeyEvent.VK_A) { CameraUtilities.pan(camera, -0.5f * (isShift ? 10 : 1), 0); eventState.addEventName(PAN_ACTION_NAME); } else if (keyCode == KeyEvent.VK_D) { CameraUtilities.pan(camera, 0.5f * (isShift ? 10 : 1), 0); eventState.addEventName(PAN_ACTION_NAME); } else if (keyCode == KeyEvent.VK_S) { CameraUtilities.pan(camera, 0, -0.5f * (isShift ? 10 : 1)); eventState.addEventName(PAN_ACTION_NAME); } else if (keyCode == KeyEvent.VK_W) { CameraUtilities.pan(camera, 0, 0.5f * (isShift ? 10 : 1)); eventState.addEventName(PAN_ACTION_NAME); } VisualGraphUtilities.setCamera(wg, camera); scheduleCameraChangeOperation(); } return STANDARD_DELAY; }); } }
Example 3
Source File: KeyboardTabSwitcher.java From otroslogviewer with Apache License 2.0 | 5 votes |
@Override public boolean postProcessKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && e.getModifiers() == InputEvent.CTRL_MASK) { if (e.getKeyCode() == KeyEvent.VK_PAGE_DOWN || e.getKeyCode() == KeyEvent.VK_LEFT) { goPrevPane(); return true; } else if (e.getKeyCode() == KeyEvent.VK_PAGE_UP || e.getKeyCode() == KeyEvent.VK_RIGHT) { goNextPane(); return true; } } return false; }
Example 4
Source File: JBinaryViewer.java From freeinternals with Apache License 2.0 | 5 votes |
@Override public void keyPressed(final KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_HOME: JBinaryViewer.this.vBar.setValue(JBinaryViewer.this.vBar.getMinimum()); break; case KeyEvent.VK_END: JBinaryViewer.this.vBar.setValue(JBinaryViewer.this.vBar.getMaximum()); break; case KeyEvent.VK_UP: JBinaryViewer.this.vBar.setValue(JBinaryViewer.this.vBar.getValue() - 1); break; case KeyEvent.VK_DOWN: JBinaryViewer.this.vBar.setValue(JBinaryViewer.this.vBar.getValue() + 1); break; case KeyEvent.VK_LEFT: case KeyEvent.VK_PAGE_UP: JBinaryViewer.this.vBar.setValue(JBinaryViewer.this.vBar.getValue() - JBinaryViewer.this.vBar.getVisibleAmount()); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_PAGE_DOWN: JBinaryViewer.this.vBar.setValue(JBinaryViewer.this.vBar.getValue() + JBinaryViewer.this.vBar.getVisibleAmount()); break; default: break; } }
Example 5
Source File: TradeScreen.java From open-ig with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean keyboard(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: { selectByRow(-1); e.consume(); return true; } case KeyEvent.VK_PAGE_UP: { selectByRow(-rowCount); e.consume(); return true; } case KeyEvent.VK_DOWN: { selectByRow(1); e.consume(); return true; } case KeyEvent.VK_PAGE_DOWN: { selectByRow(rowCount); e.consume(); return true; } default: } return super.keyboard(e); }
Example 6
Source File: ImageCommand.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
public int getKeyEvent(String key) { switch (key.toUpperCase()) { case "TAB": return KeyEvent.VK_TAB; case "ENTER": return KeyEvent.VK_ENTER; case "SHIFT": return KeyEvent.VK_SHIFT; case "CTRL": return KeyEvent.VK_CONTROL; case "ALT": return KeyEvent.VK_ALT; case "START": return KeyEvent.VK_WINDOWS; case "DELETE": return KeyEvent.VK_DELETE; case "BACKSPACE": return KeyEvent.VK_BACK_SPACE; case "HOME": return KeyEvent.VK_HOME; case "PAGE_UP": case "PAGEUP": return KeyEvent.VK_PAGE_UP; case "PAGE_DOWN": case "PAGEDOWN": return KeyEvent.VK_PAGE_DOWN; case "UP": return KeyEvent.VK_UP; case "DOWN": return KeyEvent.VK_DOWN; case "LEFT": return KeyEvent.VK_LEFT; case "RIGHT": return KeyEvent.VK_RIGHT; default: return KeyEvent.VK_ESCAPE; } }
Example 7
Source File: ListDelegationUtil.java From consulo with Apache License 2.0 | 5 votes |
public static ActionCallback installKeyboardDelegation(final JComponent focusedComponent, final JList delegateTo) { final KeyListener keyListener = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { final int code = e.getKeyCode(); final int modifiers = e.getModifiers(); switch (code) { case KeyEvent.VK_UP: ScrollingUtil.moveUp(delegateTo, modifiers); break; case KeyEvent.VK_DOWN: ScrollingUtil.moveDown(delegateTo, modifiers); break; case KeyEvent.VK_HOME: ScrollingUtil.moveHome(delegateTo); break; case KeyEvent.VK_END: ScrollingUtil.moveEnd(delegateTo); break; case KeyEvent.VK_PAGE_UP: ScrollingUtil.movePageUp(delegateTo); break; case KeyEvent.VK_PAGE_DOWN: ScrollingUtil.movePageDown(delegateTo); break; } } }; focusedComponent.addKeyListener(keyListener); final ActionCallback callback = new ActionCallback(); callback.doWhenProcessed(() -> focusedComponent.removeKeyListener(keyListener)); return callback; }
Example 8
Source File: ShortcutOptionsPanel.java From wpcleaner with Apache License 2.0 | 5 votes |
/** * Action triggered when keyboard is used. * * @param e Event. * @return True if processing should end. * @see java.awt.KeyEventDispatcher#dispatchKeyEvent(java.awt.event.KeyEvent) */ @Override public boolean dispatchKeyEvent(KeyEvent e) { int key = e.getKeyCode(); if ((key == KeyEvent.VK_ALT) || (key == KeyEvent.VK_ALT_GRAPH) || (key == KeyEvent.VK_BACK_SPACE) || (key == KeyEvent.VK_BEGIN) || (key == KeyEvent.VK_CANCEL) || (key == KeyEvent.VK_CAPS_LOCK) || (key == KeyEvent.VK_CONTROL) || (key == KeyEvent.VK_DELETE) || (key == KeyEvent.VK_DOWN) || (key == KeyEvent.VK_END) || (key == KeyEvent.VK_ENTER) || (key == KeyEvent.VK_LEFT) || (key == KeyEvent.VK_PAGE_DOWN) || (key == KeyEvent.VK_PAGE_UP) || (key == KeyEvent.VK_RIGHT) || (key == KeyEvent.VK_SHIFT) || (key == KeyEvent.VK_TAB) || (key == KeyEvent.VK_UP) || (key == KeyEvent.VK_SHIFT)) { return false; } if (key != KeyEvent.VK_ESCAPE) { setKeyCode(key); } showNotice(false); KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this); return false; }
Example 9
Source File: JRViewerPanel.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void keyNavigate(KeyEvent evt) { boolean refresh = true; switch (evt.getKeyCode()) { case KeyEvent.VK_DOWN: case KeyEvent.VK_PAGE_DOWN: dnNavigate(evt); break; case KeyEvent.VK_UP: case KeyEvent.VK_PAGE_UP: upNavigate(evt); break; case KeyEvent.VK_HOME: homeEndNavigate(0); break; case KeyEvent.VK_END: homeEndNavigate(viewerContext.getPageCount() - 1); break; default: refresh = false; } if (refresh) { viewerContext.refreshPage(); } }
Example 10
Source File: ProfilerTreeTable.java From visualvm with GNU General Public License v2.0 | 5 votes |
private boolean supportsKeyEvent(KeyEvent e) { switch (e.getKeyCode()) { // Bugfix #GH-109 // Handled by the table case KeyEvent.VK_PAGE_UP: case KeyEvent.VK_PAGE_DOWN: return false; default: return true; } }
Example 11
Source File: SelectionTool.java From workcraft with MIT License | 4 votes |
@Override public boolean keyPressed(GraphEditorKeyEvent e) { GraphEditor editor = e.getEditor(); switch (e.getKeyCode()) { case KeyEvent.VK_ESCAPE: if (isDragging()) { cancelDrag(editor); } else { cancelSelection(editor); } return true; case KeyEvent.VK_PAGE_UP: changeLevelUp(editor); return true; case KeyEvent.VK_PAGE_DOWN: changeLevelDown(editor); return true; } if (!e.isMenuKeyDown() && !e.isShiftKeyDown()) { switch (e.getKeyCode()) { case KeyEvent.VK_LEFT: offsetSelection(editor, -1, 0); return true; case KeyEvent.VK_RIGHT: offsetSelection(editor, 1, 0); return true; case KeyEvent.VK_UP: offsetSelection(editor, 0, -1); return true; case KeyEvent.VK_DOWN: offsetSelection(editor, 0, 1); return true; } } if (enablePaging && e.isAltKeyDown() && !e.isMenuKeyDown()) { switch (e.getKeyCode()) { case KeyEvent.VK_G: if (e.isShiftKeyDown()) { ungroupSelection(editor); } else { pageSelection(editor); } return true; } } if (enableGroupping && e.isMenuKeyDown() && !e.isAltKeyDown()) { switch (e.getKeyCode()) { case KeyEvent.VK_G: if (e.isShiftKeyDown()) { ungroupSelection(editor); } else { groupSelection(editor); } return true; } } if (e.isMenuKeyDown() && !e.isAltKeyDown()) { switch (e.getKeyCode()) { case KeyEvent.VK_V: Point2D pastePosition = TransformHelper.snapP5(currentMousePosition); editor.getWorkspaceEntry().setPastePosition(pastePosition); return true; } } if (e.isExtendKeyDown()) { currentNodes = getNodeWithAdjacentConnections(e.getModel(), currentNode); editor.repaint(); return true; } return super.keyPressed(e); }
Example 12
Source File: ItemPanelKeyboardListener.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
@Override public void keyPressed(KeyEvent e) { if (this.pane == null) { if (e.getSource() instanceof ItemPanel) { this.pane = ((ItemPanel) e.getSource()); } else if (e.getSource() instanceof Item) { this.pane = ((ItemPanel) ((JComponent) e.getSource()).getParent()); } } if (e.getKeyCode() == KeyEvent.VK_DELETE) { } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { if ((this.pane != null) && (this.pane.getFilePane().lastSelected != null)) { this.pane.getFilePane().filechooserUI.setCurrentDirectoryOfFileChooser(this.pane.getFilePane().lastSelected .getFile()); } } else if (e.getKeyCode() == KeyEvent.VK_SPACE) { this.pane.useKeyMoves("SPACE", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { this.pane.useKeyMoves("RIGHT", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { this.pane.useKeyMoves("LEFT", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_UP) { this.pane.useKeyMoves("UP", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { this.pane.useKeyMoves("DOWN", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_HOME) { this.pane.useKeyMoves("HOME", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_END) { this.pane.useKeyMoves("END", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { // ignore enter here! } else if (e.getKeyCode() == KeyEvent.VK_PAGE_UP) { this.pane.useKeyMoves("PAGE_UP", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else if (e.getKeyCode() == KeyEvent.VK_PAGE_DOWN) { this.pane.useKeyMoves("PAGE_DOWN", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK); } else { if (KeyEvent.getKeyText(e.getKeyCode()).toLowerCase().equals("a") && (e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK)) { this.pane.getFilePane().selectAll(); } if (e.getModifiersEx() == 0) { this.pane.forwardToNearestFor(String.valueOf(e.getKeyChar()).toLowerCase()); } } }
Example 13
Source File: MacKeymapUtil.java From consulo with Apache License 2.0 | 4 votes |
public static String getKeyText(int code) { switch (code) { case KeyEvent.VK_BACK_SPACE: return BACKSPACE; case KeyEvent.VK_ESCAPE: return ESCAPE; case KeyEvent.VK_CAPS_LOCK: return CAPS_LOCK; case KeyEvent.VK_TAB: return TAB; case KeyEvent.VK_SPACE: return SPACE; case KeyEvent.VK_DELETE: return DELETE; case KeyEvent.VK_HOME: return HOME; case KeyEvent.VK_END: return END; case KeyEvent.VK_PAGE_UP: return PAGE_UP; case KeyEvent.VK_PAGE_DOWN: return PAGE_DOWN; case KeyEvent.VK_UP: return UP; case KeyEvent.VK_DOWN: return DOWN; case KeyEvent.VK_LEFT: return LEFT; case KeyEvent.VK_RIGHT: return RIGHT; case KeyEvent.VK_NUM_LOCK: return NUMBER_LOCK; case KeyEvent.VK_ENTER: return RETURN; case KeyEvent.VK_BACK_QUOTE: return "`"; case KeyEvent.VK_NUMBER_SIGN: return NUM_PAD; case KeyEvent.VK_MULTIPLY: return NUM_PAD + " *"; case KeyEvent.VK_ADD: return "+"; case KeyEvent.VK_SEPARATOR: return ","; case KeyEvent.VK_SUBTRACT: return "-"; case KeyEvent.VK_DECIMAL: return "."; case KeyEvent.VK_DIVIDE: return "/"; case KeyEvent.VK_NUMPAD0: return "0"; case KeyEvent.VK_NUMPAD1: return "1"; case KeyEvent.VK_NUMPAD2: return "2"; case KeyEvent.VK_NUMPAD3: return "3"; case KeyEvent.VK_NUMPAD4: return "4"; case KeyEvent.VK_NUMPAD5: return "5"; case KeyEvent.VK_NUMPAD6: return "6"; case KeyEvent.VK_NUMPAD7: return "7"; case KeyEvent.VK_NUMPAD8: return "8"; case KeyEvent.VK_NUMPAD9: return "9"; case KeyEvent.VK_SLASH: return "/"; case KeyEvent.VK_BACK_SLASH: return "\\"; case KeyEvent.VK_PERIOD: return "."; case KeyEvent.VK_SEMICOLON: return ";"; case KeyEvent.VK_CLOSE_BRACKET: return "]"; case KeyEvent.VK_OPEN_BRACKET: return "["; case KeyEvent.VK_EQUALS: return "="; case KeyEvent.VK_MINUS: return "-"; case KeyEvent.VK_PLUS: return "+"; case 0: return "fn"; } return KeyEvent.getKeyText(code); }
Example 14
Source File: ReflectCompletionDialog.java From jpexs-decompiler with GNU General Public License v3.0 | 4 votes |
private void jTxtItemKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTxtItemKeyPressed int i = jLstItems.getSelectedIndex(); switch (evt.getKeyCode()) { case KeyEvent.VK_ESCAPE: target.setCaretPosition(target.getSelectionEnd()); setVisible(false); return; case KeyEvent.VK_DOWN: i++; break; case KeyEvent.VK_UP: i--; break; case KeyEvent.VK_HOME: i = 0; break; case KeyEvent.VK_END: i = jLstItems.getModel().getSize() - 1; break; case KeyEvent.VK_PAGE_DOWN: i += jLstItems.getVisibleRowCount(); break; case KeyEvent.VK_PAGE_UP: i -= jLstItems.getVisibleRowCount(); break; } if (escapeChars.indexOf(evt.getKeyChar()) >= 0) { String result = getSelection(); char pressed = evt.getKeyChar(); // we need to just accept ENTER, and replace the tab with a single // space if (pressed != '\n') { result += (pressed == '\t') ? ' ' : pressed; } target.replaceSelection(result); setVisible(false); } else { // perform bounds checks for i if (i >= jLstItems.getModel().getSize()) { i = jLstItems.getModel().getSize() - 1; } if (i < 0) { i = 0; } jLstItems.setSelectedIndex(i); jLstItems.ensureIndexIsVisible(i); } }
Example 15
Source File: CfgPropsDialog.java From nb-springboot with Apache License 2.0 | 4 votes |
@Override public void keyPressed(KeyEvent e) { final int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_ESCAPE) { final String filter = txtField.getText(); if (filter == null || filter.isEmpty()) { // close dialog if filter textfield is empty setVisible(false); } else { // clear textfield txtField.setText(null); e.consume(); } } else { final int size = lCfgProps.getModel().getSize(); // short circuit if empty size if (size == 0) { return; } int selIdx = lCfgProps.getSelectedIndex(); final int pageStep = lCfgProps.getVisibleRowCount(); // calculate new index switch (keyCode) { case KeyEvent.VK_PAGE_UP: selIdx -= pageStep; // clamp to [0 : size-1] range if (selIdx < 0) { selIdx = 0; } else if (selIdx >= size) { selIdx = size - 1; } break; case KeyEvent.VK_UP: selIdx -= 1; // wrap if needed if (selIdx < 0) { selIdx += size; } else if (selIdx >= size) { selIdx -= size; } break; case KeyEvent.VK_DOWN: selIdx += 1; // wrap if needed if (selIdx < 0) { selIdx += size; } else if (selIdx >= size) { selIdx -= size; } break; case KeyEvent.VK_PAGE_DOWN: selIdx += pageStep; // clamp to [0 : size-1] range if (selIdx < 0) { selIdx = 0; } else if (selIdx >= size) { selIdx = size - 1; } break; } // move properties list selection and scroll to it lCfgProps.setSelectedIndex(selIdx); lCfgProps.scrollRectToVisible(lCfgProps.getCellBounds(selIdx, selIdx)); } }
Example 16
Source File: ActionUtils.java From workcraft with MIT License | 4 votes |
public static String getKeyString(int keyCode) { // Letters and numbers if (((keyCode >= KeyEvent.VK_0) && (keyCode <= KeyEvent.VK_9)) || ((keyCode >= KeyEvent.VK_A) && (keyCode <= KeyEvent.VK_Z))) { return String.valueOf((char) keyCode); } switch (keyCode) { // Navigation keys case KeyEvent.VK_LEFT: return "Left"; case KeyEvent.VK_UP: return "Up"; case KeyEvent.VK_RIGHT: return "Right"; case KeyEvent.VK_DOWN: return "Down"; // Extra navigation keys case KeyEvent.VK_INSERT: return "Insert"; case KeyEvent.VK_DELETE: return "Delete"; case KeyEvent.VK_END: return "End"; case KeyEvent.VK_HOME: return "Home"; case KeyEvent.VK_PAGE_UP: return "PgUp"; case KeyEvent.VK_PAGE_DOWN: return "PgDn"; // Function keys case KeyEvent.VK_F1: return "F1"; case KeyEvent.VK_F2: return "F2"; case KeyEvent.VK_F3: return "F3"; case KeyEvent.VK_F4: return "F4"; case KeyEvent.VK_F5: return "F5"; case KeyEvent.VK_F6: return "F6"; case KeyEvent.VK_F7: return "F7"; case KeyEvent.VK_F8: return "F8"; case KeyEvent.VK_F9: return "F9"; case KeyEvent.VK_F10: return "F10"; case KeyEvent.VK_F11: return "F11"; case KeyEvent.VK_F12: return "F12"; // Symbols case KeyEvent.VK_EXCLAMATION_MARK: return "!"; case KeyEvent.VK_QUOTEDBL: return "\""; case KeyEvent.VK_EURO_SIGN: return "€"; case KeyEvent.VK_DOLLAR: return "$"; case KeyEvent.VK_CIRCUMFLEX: return "^"; case KeyEvent.VK_AMPERSAND: return "&"; case KeyEvent.VK_ASTERISK: return "*"; case KeyEvent.VK_UNDERSCORE: return "_"; case KeyEvent.VK_MINUS: return "-"; case KeyEvent.VK_PLUS: return "+"; case KeyEvent.VK_EQUALS: return "="; case KeyEvent.VK_AT: return "@"; case KeyEvent.VK_NUMBER_SIGN: return "#"; case KeyEvent.VK_COLON: return ":"; case KeyEvent.VK_SEMICOLON: return ";"; case KeyEvent.VK_COMMA: return ","; case KeyEvent.VK_PERIOD: return "."; case KeyEvent.VK_SLASH: return "/"; case KeyEvent.VK_BACK_SLASH: return "\\"; case KeyEvent.VK_DEAD_TILDE: return "~"; // Parenthesis and brackets case KeyEvent.VK_LEFT_PARENTHESIS: return "("; case KeyEvent.VK_RIGHT_PARENTHESIS: return ")"; case KeyEvent.VK_OPEN_BRACKET: return "["; case KeyEvent.VK_CLOSE_BRACKET: return "]"; case KeyEvent.VK_BRACELEFT: return "{"; case KeyEvent.VK_BRACERIGHT: return "}"; case KeyEvent.VK_LESS: return "<"; case KeyEvent.VK_GREATER: return ">"; // Formatting keys case KeyEvent.VK_SPACE: return "Space"; case KeyEvent.VK_TAB: return "Tab"; case KeyEvent.VK_ENTER: return "Enter"; case KeyEvent.VK_BACK_SPACE: return "Backspace"; case KeyEvent.VK_ESCAPE: return "Esc"; } return "0x" + Integer.toString(keyCode, 16); }
Example 17
Source File: VncClientPacketSender.java From cloudstack with Apache License 2.0 | 4 votes |
private int mapAwtKeyToVncKey(int key) { switch (key) { case KeyEvent.VK_BACK_SPACE: return 0xff08; case KeyEvent.VK_TAB: return 0xff09; case KeyEvent.VK_ENTER: return 0xff0d; case KeyEvent.VK_ESCAPE: return 0xff1b; case KeyEvent.VK_INSERT: return 0xff63; case KeyEvent.VK_DELETE: return 0xffff; case KeyEvent.VK_HOME: return 0xff50; case KeyEvent.VK_END: return 0xff57; case KeyEvent.VK_PAGE_UP: return 0xff55; case KeyEvent.VK_PAGE_DOWN: return 0xff56; case KeyEvent.VK_LEFT: return 0xff51; case KeyEvent.VK_UP: return 0xff52; case KeyEvent.VK_RIGHT: return 0xff53; case KeyEvent.VK_DOWN: return 0xff54; case KeyEvent.VK_F1: return 0xffbe; case KeyEvent.VK_F2: return 0xffbf; case KeyEvent.VK_F3: return 0xffc0; case KeyEvent.VK_F4: return 0xffc1; case KeyEvent.VK_F5: return 0xffc2; case KeyEvent.VK_F6: return 0xffc3; case KeyEvent.VK_F7: return 0xffc4; case KeyEvent.VK_F8: return 0xffc5; case KeyEvent.VK_F9: return 0xffc6; case KeyEvent.VK_F10: return 0xffc7; case KeyEvent.VK_F11: return 0xffc8; case KeyEvent.VK_F12: return 0xffc9; case KeyEvent.VK_SHIFT: return 0xffe1; case KeyEvent.VK_CONTROL: return 0xffe3; case KeyEvent.VK_META: return 0xffe7; case KeyEvent.VK_ALT: return 0xffe9; case KeyEvent.VK_ALT_GRAPH: return 0xffea; case KeyEvent.VK_BACK_QUOTE: return 0x0060; } return key; }
Example 18
Source File: ProjectTree.java From TrakEM2 with GNU General Public License v3.0 | 4 votes |
@Override public void keyPressed(final KeyEvent ke) { super.keyPressed(ke); if (ke.isConsumed()) return; if (!ke.getSource().equals(ProjectTree.this) || !project.isInputEnabled()) { return; } // get the first selected node only TreePath path = getSelectionPath(); if (null == path) return; DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); if (null == node) return; final ProjectThing pt = (ProjectThing)node.getUserObject(); if (null == pt) return; // final int flags = ke.getModifiers(); switch (ke.getKeyCode()) { case KeyEvent.VK_PAGE_UP: move(node, -1); ke.consume(); // in any case break; case KeyEvent.VK_PAGE_DOWN: move(node, 1); ke.consume(); // in any case break; case KeyEvent.VK_F2: rename(pt); ke.consume(); break; case KeyEvent.VK_H: if (0 == (flags ^ Event.ALT_MASK)) { pt.setVisible(true); ke.consume(); } else if (0 == flags) { pt.setVisible(false); ke.consume(); } break; case KeyEvent.VK_A: if (0 == flags || (0 == (flags ^ Event.SHIFT_MASK))) { selectInDisplay(pt, 0 == (flags ^ Event.SHIFT_MASK)); ke.consume(); } break; case KeyEvent.VK_3: if (0 == flags) { ini.trakem2.display.Display3D.showAndResetView(pt); ke.consume(); break; } // else, flow: case KeyEvent.VK_1: case KeyEvent.VK_2: case KeyEvent.VK_4: case KeyEvent.VK_5: case KeyEvent.VK_6: case KeyEvent.VK_7: case KeyEvent.VK_8: case KeyEvent.VK_9: // run a plugin, if any if (pt.getObject() instanceof Displayable && null != Utils.launchTPlugIn(ke, "Project Tree", project, (Displayable)pt.getObject())) { ke.consume(); } break; } ke.consume(); }
Example 19
Source File: KeyToggler.java From Any-Angle-Pathfinding with The Unlicense | 4 votes |
@Override public void keyPressed(KeyEvent arg0) { switch(arg0.getKeyCode()) { case KeyEvent.VK_RIGHT : goRight(1, false); break; case KeyEvent.VK_LEFT : goLeft(1, false); break; case KeyEvent.VK_UP : goRight(1, true); break; case KeyEvent.VK_DOWN : goLeft(1, true); break; case KeyEvent.VK_PAGE_UP : goRight(10, false); break; case KeyEvent.VK_PAGE_DOWN : goLeft(10, false); break; case KeyEvent.VK_D : goRight(3, true); break; case KeyEvent.VK_A : goLeft(3, true); break; case KeyEvent.VK_W : goRight(5, true); break; case KeyEvent.VK_S : goLeft(5, true); break; // O: Go right one step + take screenshot, loops around case KeyEvent.VK_O : if (goRight(1, false)) takeSnapShot(); break; // P: Go right one step + take screenshot, stop at end case KeyEvent.VK_P : if (goRight(1, true)) takeSnapShot(); break; // L: Go right multiple steps + take screenshot, stop at end case KeyEvent.VK_L : if (goRight(13, true)) takeSnapShot(); break; // Esc: Close Window case KeyEvent.VK_ESCAPE : System.exit(0); break; } }
Example 20
Source File: AvatarChooser.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | votes |
@Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); switch (keyCode) { case KeyEvent.VK_LEFT: case KeyEvent.VK_UP: scrollAndAnimateBy(-1); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_DOWN: scrollAndAnimateBy(1); break; case KeyEvent.VK_END: scrollBy(avatars.size() - avatarIndex - 1); break; case KeyEvent.VK_HOME: scrollBy(-avatarIndex - 1); break; case KeyEvent.VK_PAGE_UP: scrollAndAnimateBy(-avatarAmount / 2); break; case KeyEvent.VK_PAGE_DOWN: scrollAndAnimateBy(avatarAmount / 2); break; } }