Java Code Examples for java.awt.event.KeyEvent#VK_F1
The following examples show how to use
java.awt.event.KeyEvent#VK_F1 .
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: KeyHandler.java From yt-java-game with MIT License | 5 votes |
public void toggle(KeyEvent e, boolean pressed) { if(e.getKeyCode() == KeyEvent.VK_W) up.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_S) down.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_A) left.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_D) right.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_SPACE) attack.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_E) menu.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_ENTER) enter.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_ESCAPE) escape.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_F1) f1.toggle(pressed); if(e.getKeyCode() == KeyEvent.VK_SHIFT) shift.toggle(pressed); }
Example 2
Source File: CDIPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { if (e.getKeyCode() == KeyEvent.VK_F1 || e.getKeyCode() == KeyEvent.VK_HELP) { JComponent rootPane = SwingUtilities.getRootPane(this); if (rootPane != null) { rootPane.putClientProperty(ResizablePopup.HELP_COOKIE, Boolean.TRUE); } } return super.processKeyBinding(ks, e, condition, pressed); }
Example 3
Source File: Window.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Implements a debugging hook -- checks to see if * the user has typed <i>control-shift-F1</i>. If so, * the list of child windows is dumped to {@code System.out}. * @param e the keyboard event */ void preProcessKeyEvent(KeyEvent e) { // Dump the list of child windows to System.out if debug is enabled. if (DebugSettings.getInstance().getBoolean("on", false)) { if (e.isActionKey() && e.getKeyCode() == KeyEvent.VK_F1 && e.isControlDown() && e.isShiftDown() && e.getID() == KeyEvent.KEY_PRESSED) { list(System.out, 0); } } }
Example 4
Source File: Window.java From Snake with GNU General Public License v3.0 | 5 votes |
@Override public void keyPressed(KeyEvent keyEvent) { if (!engine.running && keyEvent.getKeyCode() != KeyEvent.VK_F1 && keyEvent.getKeyCode() != KeyEvent.VK_F2 && keyEvent.getKeyCode() != KeyEvent.VK_F3 && keyEvent.getKeyCode() != KeyEvent.VK_F4 && keyEvent.getKeyCode() != KeyEvent.VK_F5) { startGame(engine); engine.running = true; } if (keyEvent.getKeyCode() == KeyEvent.VK_LEFT) { engine.gameBoard.directionLeft(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) { engine.gameBoard.directionRight(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_UP) { engine.gameBoard.directionUp(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_DOWN) { engine.gameBoard.directionDown(); } if (keyEvent.getKeyCode() == KeyEvent.VK_F1) { Properties.Dark(); repaint(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_F2) { Properties.Sky(); repaint(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_F3) { Properties.Mud(); repaint(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_F4) { Properties.Sand(); repaint(); } else if (keyEvent.getKeyCode() == KeyEvent.VK_F5) { Properties.Rainbow(); repaint(); } }
Example 5
Source File: HiCKeyDispatcher.java From JuiceboxLegacy with MIT License | 5 votes |
@Override public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_F1) { if (hic.getControlZd() != null) { MatrixType displayOption = (MatrixType) displayOptionComboBox.getSelectedItem(); if (displayOption == MatrixType.CONTROL) { displayOptionComboBox.setSelectedItem(MatrixType.OBSERVED); } else if (displayOption == MatrixType.OBSERVED) { displayOptionComboBox.setSelectedItem(MatrixType.CONTROL); } } return true; } else if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_F10) { String newURL = MessageUtils.showInputDialog("Specify a new properties file", HiCGlobals.defaultPropertiesURL); if (newURL != null) { HiCFileLoader.changeJuiceboxPropertiesFile(newURL); } return true; } else { return false; } }
Example 6
Source File: ReadKeyCodesTest.java From openmeetings with Apache License 2.0 | 5 votes |
@Override public void keyPressed(KeyEvent event) { msg1 = ""; System.out.println("keyPressed "+event.getKeyCode()); if (event.getKeyChar() == KeyEvent.CHAR_UNDEFINED) { int key = event.getKeyCode(); // Funktionstaste abfragen if (key == KeyEvent.VK_F1) { msg1 = "F1"; } else if (key == KeyEvent.VK_F2) { msg1 = "F2"; } else if (key == KeyEvent.VK_F3) { msg1 = "F3"; } // Modifier abfragen if (msg1.length() > 0) { if (event.isAltDown()) { msg1 = "ALT + " + msg1; } if (event.isControlDown()) { msg1 = "STRG + " + msg1; } if (event.isShiftDown()) { msg1 = "UMSCHALT + " + msg1; } } } repaint(); }
Example 7
Source File: FunctionPanel.java From opensim-gui with Apache License 2.0 | 5 votes |
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_CONTROL) { if (picking == true) endBoxSelect(); picking = false; } else if (e.getKeyCode() == KeyEvent.VK_F1) { //mandatoryCrosshairs = false; //setCrosshairsState(false); } }
Example 8
Source File: Keyboard.java From OberonEmulator with ISC License | 5 votes |
public void press(int location, int keyCode) { if (keyCode == KeyEvent.VK_F1) type((char) 26); if (keyCode == KeyEvent.VK_LEFT) type((char) 0x11); if (keyCode == KeyEvent.VK_RIGHT) type((char) 0x12); if (keyCode == KeyEvent.VK_UP) type((char) 0x13); if (keyCode == KeyEvent.VK_DOWN) type((char) 0x14); }
Example 9
Source File: Commander.java From Scripts with GNU General Public License v3.0 | 5 votes |
@Override public boolean dispatchKeyEvent(final KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_F1) { toggleVisibility(); return true; } return false; }
Example 10
Source File: ProjectToolbar.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
static public void keyPressed(KeyEvent ke) { switch (ke.getKeyCode()) { case KeyEvent.VK_F1: setTool(Toolbar.RECTANGLE); break; case KeyEvent.VK_F2: setTool(Toolbar.POLYGON); break; case KeyEvent.VK_F3: setTool(Toolbar.FREEROI); break; case KeyEvent.VK_F4: setTool(Toolbar.TEXT); break; case KeyEvent.VK_F5: setTool(Toolbar.MAGNIFIER); break; case KeyEvent.VK_F6: setTool(Toolbar.HAND); break; case KeyEvent.VK_F7: break; case KeyEvent.VK_F8: break; case KeyEvent.VK_F9: setTool(SELECT); break; case KeyEvent.VK_F10: setTool(PENCIL); break; case KeyEvent.VK_F11: setTool(PEN); break; case KeyEvent.VK_F12: setTool(BRUSH); break; } }
Example 11
Source File: KeyEntryTextField.java From ghidra with Apache License 2.0 | 4 votes |
private boolean isHelpKey(int keyCode) { return keyCode == KeyEvent.VK_F1 || keyCode == KeyEvent.VK_HELP; }
Example 12
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 13
Source File: VncClientPacketSender.java From cosmic with Apache License 2.0 | 4 votes |
private int mapAwtKeyToVncKey(final 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 14
Source File: KeyCodesTest.java From openmeetings with Apache License 2.0 | 4 votes |
@Override public void keyPressed(KeyEvent event) { msg1 = ""; System.out.println("keyPressed CODE1 "+event.getKeyCode()); int myCode = event.getKeyCode(); System.out.println("keyPressed CODE2 "+myCode); System.out.println("keyPressed CHAR3 "+event.getKeyChar()); System.out.println("keyPressed CHAR4 "+KeyEvent.getKeyText(event.getKeyCode())); System.out.println("keyPressed CHAR5 "+KeyEvent.getKeyText(myCode)); System.out.println("keyPressed isActionKey "+event.isActionKey()); System.out.println("keyPressed isAltDown "+event.isAltDown()); System.out.println("keyPressed isAltGraphDown "+event.isAltGraphDown()); System.out.println("keyPressed isConsumed "+event.isConsumed()); System.out.println("keyPressed isControlDown "+event.isControlDown()); System.out.println("keyPressed isMetaDown "+event.isMetaDown()); System.out.println("keyPressed isShiftDown "+event.isShiftDown()); System.out.println("keyPressed paramString "+event.paramString()); if (event.getKeyChar() == KeyEvent.CHAR_UNDEFINED) { int key = event.getKeyCode(); // Funktionstaste abfragen if (key == KeyEvent.VK_F1) { msg1 = "F1"; } else if (key == KeyEvent.VK_F2) { msg1 = "F2"; } else if (key == KeyEvent.VK_F3) { msg1 = "F3"; } // Modifier abfragen if (msg1.length() > 0) { if (event.isAltDown()) { msg1 = "ALT + " + msg1; } if (event.isControlDown()) { msg1 = "STRG + " + msg1; } if (event.isShiftDown()) { msg1 = "UMSCHALT + " + msg1; } } } repaint(); }
Example 15
Source File: GOSwingEventConverter.java From settlers-remake with MIT License | 4 votes |
private String getKeyName(KeyEvent e) { String text = KeyEvent.getKeyText(e.getKeyCode()); if (text == null || text.length() != 1) { switch (e.getKeyCode()) { case KeyEvent.VK_LEFT: text = "LEFT"; break; case KeyEvent.VK_RIGHT: text = "RIGHT"; break; case KeyEvent.VK_DOWN: text = "DOWN"; break; case KeyEvent.VK_UP: text = "UP"; break; case KeyEvent.VK_PAUSE: text = "PAUSE"; break; case KeyEvent.VK_F1: text = "F1"; break; case KeyEvent.VK_F2: text = "F2"; break; case KeyEvent.VK_F3: text = "F3"; break; case KeyEvent.VK_F4: text = "F4"; break; case KeyEvent.VK_F5: text = "F5"; break; case KeyEvent.VK_F6: text = "F6"; break; case KeyEvent.VK_F7: text = "F7"; break; case KeyEvent.VK_F8: text = "F8"; break; case KeyEvent.VK_F9: text = "F9"; break; case KeyEvent.VK_F10: text = "F10"; break; case KeyEvent.VK_F11: text = "F11"; break; case KeyEvent.VK_F12: text = "F12"; break; case KeyEvent.VK_PLUS: text = "+"; break; case KeyEvent.VK_MINUS: text = "-"; break; case KeyEvent.VK_DELETE: text = "DELETE"; break; case KeyEvent.VK_SPACE: text = " "; break; case KeyEvent.VK_ESCAPE: text = "ESCAPE"; break; case KeyEvent.VK_BACK_SPACE: text = "BACK_SPACE"; break; case KeyEvent.VK_TAB: text = "TAB"; break; default: text = "" + e.getKeyChar(); } } return text; }
Example 16
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; }