Java Code Examples for java.awt.event.KeyEvent#VK_B
The following examples show how to use
java.awt.event.KeyEvent#VK_B .
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: PolicySelectionTool.java From workcraft with MIT License | 6 votes |
@Override public boolean keyPressed(GraphEditorKeyEvent e) { if (e.isMenuKeyDown()) { switch (e.getKeyCode()) { case KeyEvent.VK_B: if (e.isShiftKeyDown()) { selectionUnbundle(e.getEditor()); } else { selectionBundle(e.getEditor()); } e.getEditor().repaint(); return true; } } return super.keyPressed(e); }
Example 2
Source File: KeyboardSupport.java From CrossMobile with GNU Lesser General Public License v3.0 | 5 votes |
public static void reactToReleaseEvent(CEventCallback callback, int vk_event, int modifier) { switch (vk_event) { case KeyEvent.VK_CONTROL: if ((mask & MULTITOUCH.mask) != 0) callback.endMultiTouch(); break; case KeyEvent.VK_B: case KeyEvent.VK_BACK_SPACE: if ((mask & BACK.mask) != 0) callback.back(); break; case KeyEvent.VK_P: case KeyEvent.VK_SPACE: if ((mask & PAUSE.mask) != 0) ((DesktopLifecycleBridge) Native.lifecycle()).toggleActivation(); break; case KeyEvent.VK_ESCAPE: case KeyEvent.VK_Q: if ((mask & QUIT.mask) != 0) callback.powerOff(); break; case KeyEvent.VK_M: if (modifier == KeyEvent.CTRL_MASK) memoryWarning(); break; case KeyEvent.VK_H: case KeyEvent.VK_HOME: if ((mask & HOME.mask) != 0) callback.home(); break; case KeyEvent.VK_LEFT: if ((mask & ROTATE.mask) != 0) callback.rotateLeft(); break; case KeyEvent.VK_RIGHT: if ((mask & ROTATE.mask) != 0) callback.rotateRight(); break; } }
Example 3
Source File: ApplicationKeyListener.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 5 votes |
/** * Performs certain actions for certain keys: * <ul> * <li>Escape: close application</li> * <li>V and B: cancel rotation</li> * <li>N: clear rotation</li> * </ul> * @param e The key event */ @Override public void keyReleased(KeyEvent e) { if (KeyEvent.VK_ESCAPE == e.getKeyCode()) { //Close application on escape Utilities.closeApplication(frame); } else if (KeyEvent.VK_V == e.getKeyCode() || KeyEvent.VK_B == e.getKeyCode()) { //Cancel rotation rotateTimer.stop(); } else if (KeyEvent.VK_N == e.getKeyCode()) { mapController.setRotation(0); mapController.getLocationController().setNavigationMode(NavigationMode.NORTH_UP); } }
Example 4
Source File: SONSelectionTool.java From workcraft with MIT License | 5 votes |
@Override public boolean keyPressed(GraphEditorKeyEvent e) { if (e.isAltKeyDown() && !e.isMenuKeyDown() && !e.isShiftKeyDown()) { switch (e.getKeyCode()) { case KeyEvent.VK_B: selectionBlock(e.getEditor()); return true; } } return super.keyPressed(e); }
Example 5
Source File: SmoothMoves.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Toggles various rendering flags */ public void keyPressed(KeyEvent ke) { int keyCode = ke.getKeyCode(); if (keyCode == KeyEvent.VK_B) { // B: Motion blur - displays trail of ghost images motionBlur = !motionBlur; } else if (keyCode == KeyEvent.VK_A) { // A: Antialiasing - Displays soft edges around graphics useAA = !useAA; createAnimationImage(); } else if (keyCode == KeyEvent.VK_C) { // C: Color - Toggles rectangle color between dark and light colors alterColor = !alterColor; createAnimationImage(); } else if (keyCode == KeyEvent.VK_I) { // I: Image - Toggles use of image or filled rectangle to show how // straight edges affect animation perception useImage = !useImage; createAnimationImage(); } else if (keyCode == KeyEvent.VK_UP) { // Up Arrow: Speed - Speeds up frame rate changeResolution(true); } else if (keyCode == KeyEvent.VK_DOWN) { // Down Arrow: Speed - Slows down frame rate changeResolution(false); } else if (keyCode == KeyEvent.VK_L) { // L: Linearity: Toggles linear/nonlinear motion linear = !linear; } else if (keyCode >= KeyEvent.VK_1 && keyCode <= KeyEvent.VK_9) { // 0-9: Blur size: Toggles size of ghost trail for motion blur blurSize = keyCode - KeyEvent.VK_0; prevMoveX = prevMoveY = null; } }
Example 6
Source File: ShortcutListener.java From jeddict with Apache License 2.0 | 5 votes |
@Override public void keyPressed(KeyEvent e) { super.keyPressed(e); if (e.isControlDown() == true) { if (e.getKeyCode() == KeyEvent.VK_G) { JPAModelerUtil.generateSourceCode(file); } else if (e.getKeyCode() == KeyEvent.VK_D) { DBUtil.openDBModeler(file); } else if (e.getKeyCode() == KeyEvent.VK_B) { JSONBUtil.openJSONBViewer(file); } } }
Example 7
Source File: ShortcutListener.java From jeddict with Apache License 2.0 | 5 votes |
@Override public void keyPressed(KeyEvent e) { super.keyPressed(e); if (e.isControlDown() == true) { if (e.getKeyCode() == KeyEvent.VK_L) { SQLEditorUtil.openEditor(file, ((DBMapping) file.getModelerScene().getBaseElementSpec()).getSQL()); }else if (e.getKeyCode() == KeyEvent.VK_B) { JSONBUtil.openJSONBViewer(file.getParentFile()); } else if (e.getKeyCode() == KeyEvent.VK_G) { JPAModelerUtil.generateSourceCode(file.getParentFile()); } } }
Example 8
Source File: RobotKeyPressMidi.java From haxademic with MIT License | 5 votes |
protected void firstFrame() { MidiDevice.init(0, 0); try { _robot = new Robot(); } catch( Exception error ) { println("couldn't init Robot"); } midiKeyTriggers = new MidiKeyTrigger[] { new MidiKeyTrigger(39, KeyEvent.VK_V), new MidiKeyTrigger(40, KeyEvent.VK_A), new MidiKeyTrigger(54, KeyEvent.VK_B), new MidiKeyTrigger(65, KeyEvent.VK_L) }; }
Example 9
Source File: Visualization.java From whyline with MIT License | 4 votes |
public boolean handleKeyPressed(KeyEvent event) { updateMeta(); switch(event.getKeyCode()) { case KeyEvent.VK_T : whylineUI.getActions().showHideThreads.actionPerformed(null); return true; case KeyEvent.VK_B : EventView view = getSelectedEventView(); if(view != null) { Instruction inst = trace.getInstruction(view.getEventID()); if(inst != null) { Line line = inst.getLine(); if(line != null) { boolean wasNew = whylineUI.getPersistentState().addRelevantLine(line); if(wasNew) return true; } } } Toolkit.getDefaultToolkit().beep(); return true; case KeyEvent.VK_ESCAPE : getWhylineUI().getActions().collapseBlock.execute(); return true; case KeyEvent.VK_ENTER : getWhylineUI().getActions().addToExplanation.execute(); return true; case KeyEvent.VK_COMMA : if(!showPreviousOrNextEventInThreadOrMethod(true, true)) Toolkit.getDefaultToolkit().beep(); return true; case KeyEvent.VK_PERIOD : if(!showPreviousOrNextEventInThreadOrMethod(false, true)) Toolkit.getDefaultToolkit().beep(); return true; case KeyEvent.VK_LEFT : if(isMetaDown) { if(!showPreviousOrNextEventInThreadOrMethod(true, false)) Toolkit.getDefaultToolkit().beep(); } else getWhylineUI().getActions().goToPreviousEvent.execute(); return true; case KeyEvent.VK_RIGHT : if(isMetaDown) { if(!showPreviousOrNextEventInThreadOrMethod(false, false)) Toolkit.getDefaultToolkit().beep(); } else getWhylineUI().getActions().goToNextEvent.execute(); return true; case KeyEvent.VK_UP : getWhylineUI().getActions().goToPreviousBlock.execute(); return true; case KeyEvent.VK_DOWN : getWhylineUI().getActions().goToNextBlock.execute(); return true; } if(Character.isLetterOrDigit(event.getKeyChar())) return goToDataDependency(event.getKeyChar(), !isMetaDown); return false; }
Example 10
Source File: Robot.java From xnx3 with Apache License 2.0 | 4 votes |
/** * 将字符型转换为按键码,可直接使用 {@link #press(int)}调用 * @param key 字符型文字,包含 0~9 a~z . * @return 按键码 */ public int StringToKey(String key){ switch (key) { case "a": return KeyEvent.VK_A; case "b": return KeyEvent.VK_B; case "c": return KeyEvent.VK_C; case "d": return KeyEvent.VK_D; case "e": return KeyEvent.VK_E; case "f": return KeyEvent.VK_F; case "g": return KeyEvent.VK_G; case "h": return KeyEvent.VK_H; case "i": return KeyEvent.VK_I; case "j": return KeyEvent.VK_J; case "k": return KeyEvent.VK_K; case "l": return KeyEvent.VK_L; case "m": return KeyEvent.VK_M; case "n": return KeyEvent.VK_N; case "o": return KeyEvent.VK_O; case "p": return KeyEvent.VK_P; case "q": return KeyEvent.VK_Q; case "r": return KeyEvent.VK_R; case "s": return KeyEvent.VK_S; case "t": return KeyEvent.VK_T; case "u": return KeyEvent.VK_U; case "v": return KeyEvent.VK_V; case "w": return KeyEvent.VK_W; case "x": return KeyEvent.VK_X; case "y": return KeyEvent.VK_Y; case "z": return KeyEvent.VK_Z; case "0": return KeyEvent.VK_0; case "1": return KeyEvent.VK_1; case "2": return KeyEvent.VK_2; case "3": return KeyEvent.VK_3; case "4": return KeyEvent.VK_4; case "5": return KeyEvent.VK_5; case "6": return KeyEvent.VK_6; case "7": return KeyEvent.VK_7; case "8": return KeyEvent.VK_8; case "9": return KeyEvent.VK_9; case ".": return KeyEvent.VK_PERIOD; default: break; } return 0; }
Example 11
Source File: KeyCodeToChar.java From Repeat with Apache License 2.0 | 4 votes |
private static String getLowerCaseAlphaChar(int code) { switch (code) { case KeyEvent.VK_Q: return "q"; case KeyEvent.VK_W: return "w"; case KeyEvent.VK_E: return "e"; case KeyEvent.VK_R: return "r"; case KeyEvent.VK_T: return "t"; case KeyEvent.VK_Y: return "y"; case KeyEvent.VK_U: return "u"; case KeyEvent.VK_I: return "i"; case KeyEvent.VK_O: return "o"; case KeyEvent.VK_P: return "p"; case KeyEvent.VK_A: return "a"; case KeyEvent.VK_S: return "s"; case KeyEvent.VK_D: return "d"; case KeyEvent.VK_F: return "f"; case KeyEvent.VK_G: return "g"; case KeyEvent.VK_H: return "h"; case KeyEvent.VK_J: return "j"; case KeyEvent.VK_K: return "k"; case KeyEvent.VK_L: return "l"; case KeyEvent.VK_Z: return "z"; case KeyEvent.VK_X: return "x"; case KeyEvent.VK_C: return "c"; case KeyEvent.VK_V: return "v"; case KeyEvent.VK_B: return "b"; case KeyEvent.VK_N: return "n"; case KeyEvent.VK_M: return "m"; default: return ""; } }
Example 12
Source File: KeyCodeToChar.java From Repeat with Apache License 2.0 | 4 votes |
private static String getUpperCaseAlphaChar(int code) { switch (code) { case KeyEvent.VK_Q: return "Q"; case KeyEvent.VK_W: return "W"; case KeyEvent.VK_E: return "E"; case KeyEvent.VK_R: return "R"; case KeyEvent.VK_T: return "T"; case KeyEvent.VK_Y: return "Y"; case KeyEvent.VK_U: return "U"; case KeyEvent.VK_I: return "I"; case KeyEvent.VK_O: return "O"; case KeyEvent.VK_P: return "P"; case KeyEvent.VK_A: return "A"; case KeyEvent.VK_S: return "S"; case KeyEvent.VK_D: return "D"; case KeyEvent.VK_F: return "F"; case KeyEvent.VK_G: return "G"; case KeyEvent.VK_H: return "H"; case KeyEvent.VK_J: return "J"; case KeyEvent.VK_K: return "K"; case KeyEvent.VK_L: return "L"; case KeyEvent.VK_Z: return "Z"; case KeyEvent.VK_X: return "X"; case KeyEvent.VK_C: return "C"; case KeyEvent.VK_V: return "V"; case KeyEvent.VK_B: return "B"; case KeyEvent.VK_N: return "N"; case KeyEvent.VK_M: return "M"; default: return ""; } }
Example 13
Source File: Commander.java From Scripts with GNU General Public License v3.0 | 4 votes |
@Override public void keyPressed(final KeyEvent ke) { final int key = ke.getKeyCode(); final Object source = ke.getSource(); final boolean meta = (ke.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0; final boolean metaShift = meta && ke.isShiftDown(); // Close if Esc, Ctrl+W or Cmd+W if (key == KeyEvent.VK_ESCAPE || (key == KeyEvent.VK_W && meta)) { quit(); // Trigger Menu accelerators } else if (metaShift) { if (key == KeyEvent.VK_C) // Enter/Exit Console toggleConsoleMode(); else if (key == KeyEvent.VK_G) // Go To... changeDirectory(""); else if (!isConsoleMode() && key == KeyEvent.VK_R) // Reveal Path Utils.revealFile(path); } else if (meta) { if (key == KeyEvent.VK_L) { prompt.requestFocusInWindow(); prompt.selectAll(); } else if (key == KeyEvent.VK_B) { activateTable(); } else if (key == KeyEvent.VK_COMMA) { showOptionsDialog(); } else if (key == KeyEvent.VK_S) { saveQuery(); } else if (!isConsoleMode() && key == KeyEvent.VK_D) { addBookmark(); } else if (!isConsoleMode() && key == KeyEvent.VK_P) { printList(); } else if (!isConsoleMode() && key == KeyEvent.VK_R) { resetFileList("Contents reloaded..."); } } else if (source == prompt) { // Up or down arrows pressed in prompt: Move the focus to list if (key == KeyEvent.VK_UP || key == KeyEvent.VK_DOWN) { activateTable(); } } else if (source == table) { // Focus in list and left arrow key: move up in directory hierarchy if (key == KeyEvent.VK_LEFT) { selectParentDirectory(path); setSelectedItem(table.getSelectedRow()); // Focus in list and right arrow key: List sub-directory } else if (key == KeyEvent.VK_RIGHT) { setSelectedItem(table.getSelectedRow()); if (isFolder(selectedItem)) selectSubDirectory(selectedItem); // Focus in list and enter: Open selected item } else if (key == KeyEvent.VK_ENTER) { ke.consume(); setSelectedItem(table.getSelectedRow()); openItem(selectedItem); // Focus in list and backspace: Switch focus back to prompt } else if (key == KeyEvent.VK_BACK_SPACE) { prompt.requestFocusInWindow(); prompt.selectAll(); // Focus in list and up/down arrow key: Loop through list } else if (key == KeyEvent.VK_UP) { if (table.getSelectedRow() == 0) table.setRowSelectionInterval(tableModel.getRowCount() - 1, tableModel.getRowCount() - 1); } else if (key == KeyEvent.VK_DOWN) { if (table.getSelectedRow() == tableModel.getRowCount() - 1) table.setRowSelectionInterval(0, 0); } } }