Java Code Examples for java.awt.event.KeyEvent#VK_F
The following examples show how to use
java.awt.event.KeyEvent#VK_F .
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: JDA.java From java-disassembler with GNU General Public License v3.0 | 6 votes |
/** * Checks the hotkeys */ public static void checkHotKey(KeyEvent e) { if ((e.getKeyCode() == KeyEvent.VK_O) && isCtrlDown(e)) { openFileChooser(); } else if ((e.getKeyCode() == KeyEvent.VK_N) && isCtrlDown(e)) { JDA.resetWorkSpace(true); } else if ((e.getKeyCode() == KeyEvent.VK_R) && isCtrlDown(e) && isShiftDown(e)) { viewer.reloadResources(); } else if ((e.getKeyCode() == KeyEvent.VK_R) && isCtrlDown(e)) { viewer.refreshView(); } else if ((e.getKeyCode() == KeyEvent.VK_W) && isCtrlDown(e) && isShiftDown(e)) { JDA.closeResources(true); } else if ((e.getKeyCode() == KeyEvent.VK_W) && isCtrlDown(e)) { if (viewer.fileViewerPane.getCurrentViewer() != null) viewer.fileViewerPane.tabs.remove(viewer.fileViewerPane.getCurrentViewer()); } else if ((e.getKeyCode() == KeyEvent.VK_F) && isCtrlDown(e) && isShiftDown(e)) { viewer.doSearchDialog(); } }
Example 2
Source File: BankPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (config.ctrlfSearch() && e.isControlDown() && e.getKeyCode() == KeyEvent.VK_F) { Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); if (bankContainer == null || bankContainer.isHidden()) { return; } bankSearch.initSearch(); e.consume(); } }
Example 3
Source File: CommandDispatcher.java From IBC with GNU General Public License v3.0 | 5 votes |
private void handleReconnectDataCommand() { JFrame jf = MainWindowManager.mainWindowManager().getMainWindow(1, TimeUnit.MILLISECONDS); int modifiers = KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK; KeyEvent pressed=new KeyEvent(jf, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), modifiers, KeyEvent.VK_F, KeyEvent.CHAR_UNDEFINED); KeyEvent typed=new KeyEvent(jf, KeyEvent.KEY_TYPED, System.currentTimeMillis(), modifiers, KeyEvent.VK_UNDEFINED, 'F' ); KeyEvent released=new KeyEvent(jf, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), modifiers, KeyEvent.VK_F, KeyEvent.CHAR_UNDEFINED ); jf.dispatchEvent(pressed); jf.dispatchEvent(typed); jf.dispatchEvent(released); mChannel.writeAck(""); }
Example 4
Source File: ConstructionWizard.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Sets the new x and y location and facing of the site * @param c */ public void processKeyRelease(int c) { if (c == KeyEvent.VK_UP // 38 || c == KeyEvent.VK_KP_UP || c == KeyEvent.VK_W || c == KeyEvent.VK_NUMPAD8) { upKeyPressed = false; } else if(c == KeyEvent.VK_DOWN // 40 || c == KeyEvent.VK_KP_DOWN || c == KeyEvent.VK_S || c == KeyEvent.VK_NUMPAD2) { downKeyPressed = false; } else if(c == KeyEvent.VK_LEFT // 37 || c == KeyEvent.VK_KP_LEFT || c == KeyEvent.VK_A || c == KeyEvent.VK_NUMPAD4) { leftKeyPressed = false; } else if(c == KeyEvent.VK_RIGHT // 39 || c == KeyEvent.VK_KP_RIGHT || c == KeyEvent.VK_D || c == KeyEvent.VK_NUMPAD6) { rightKeyPressed = false; } else if(c == KeyEvent.VK_R || c == KeyEvent.VK_F) { turnKeyPressed = false; } }
Example 5
Source File: CommandDispatcher.java From ib-controller with GNU General Public License v3.0 | 5 votes |
private void handleReconnectDataCommand() { JFrame jf = MainWindowManager.mainWindowManager().getMainWindow(1, TimeUnit.MILLISECONDS); int modifiers = KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK; KeyEvent pressed=new KeyEvent(jf, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), modifiers, KeyEvent.VK_F, KeyEvent.CHAR_UNDEFINED); KeyEvent typed=new KeyEvent(jf, KeyEvent.KEY_TYPED, System.currentTimeMillis(), modifiers, KeyEvent.VK_UNDEFINED, 'F' ); KeyEvent released=new KeyEvent(jf, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), modifiers, KeyEvent.VK_F, KeyEvent.CHAR_UNDEFINED ); jf.dispatchEvent(pressed); jf.dispatchEvent(typed); jf.dispatchEvent(released); mChannel.writeAck(""); }
Example 6
Source File: MainFrameMenu.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
public boolean dispatchKeyEvent(KeyEvent e) { if (((JFrame) mainFrame).isActive() && e.getID() == KeyEvent.KEY_PRESSED) { HotKey ek = new HotKey(e); for (String path : menuHotkeys.keySet()) { HotKey mk = menuHotkeys.get(path); if (ek.equals(mk)) { if (menuActions.containsKey(path)) { menuActions.get(path).actionPerformed(null); return true; } } } //other nonmenu actions int code = e.getKeyCode(); if (e.isControlDown() && e.isShiftDown()) { //CTRL+SHIFT switch (code) { case KeyEvent.VK_F: return searchInActionPerformed(null); case KeyEvent.VK_T: return searchInTextPerformed(null); case KeyEvent.VK_D: return clearLog(null); } } else if (e.isControlDown() && !e.isShiftDown()) { //CTRL switch (code) { case KeyEvent.VK_UP: return previousTag(null); case KeyEvent.VK_DOWN: return nextTag(null); } } } return false; }
Example 7
Source File: PlotFrame.java From OpenDA with GNU Lesser General Public License v3.0 | 4 votes |
/** Construct a plot frame with the specified title and the specified * instance of PlotBox. After constructing this, it is necessary * to call setVisible(true) to make the plot appear. * @param title The title to put on the window. * @param plotArg the plot object to put in the frame, or null to create * an instance of Plot. */ public PlotFrame(String title, PlotBox plotArg) { super(title); if (plotArg == null) { plot = new Plot(); } else { plot = plotArg; } // Background color is a light grey. plot.setBackground(new Color(0xe5e5e5)); _fileMenu.setMnemonic(KeyEvent.VK_F); _editMenu.setMnemonic(KeyEvent.VK_E); _specialMenu.setMnemonic(KeyEvent.VK_S); // File menu JMenuItem[] fileMenuItems = { new JMenuItem("Open", KeyEvent.VK_O), new JMenuItem("Save", KeyEvent.VK_S), new JMenuItem("Save as....", KeyEvent.VK_A), new JMenuItem("Export", KeyEvent.VK_E), new JMenuItem("Print", KeyEvent.VK_P), new JMenuItem("Close", KeyEvent.VK_C), }; // Open button = ctrl-o. fileMenuItems[0].setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK)); // Save button = ctrl-s. fileMenuItems[1].setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); // Print button = ctrl-p. fileMenuItems[4].setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK)); // Close button = ctrl-w. fileMenuItems[5].setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK)); FileMenuListener fml = new FileMenuListener(); // Set the action command and listener for each menu item. for (int i = 0; i < fileMenuItems.length; i++) { fileMenuItems[i].setActionCommand(fileMenuItems[i].getText()); fileMenuItems[i].addActionListener(fml); _fileMenu.add(fileMenuItems[i]); } _menubar.add(_fileMenu); // Edit menu JMenuItem format = new JMenuItem("Format", KeyEvent.VK_F); FormatListener formatListener = new FormatListener(); format.addActionListener(formatListener); _editMenu.add(format); _menubar.add(_editMenu); // Special menu JMenuItem[] specialMenuItems = { new JMenuItem("About", KeyEvent.VK_A), new JMenuItem("Help", KeyEvent.VK_H), new JMenuItem("Clear", KeyEvent.VK_C), new JMenuItem("Fill", KeyEvent.VK_F), new JMenuItem("Reset axes", KeyEvent.VK_R), new JMenuItem("Sample plot", KeyEvent.VK_S), }; SpecialMenuListener sml = new SpecialMenuListener(); // Set the action command and listener for each menu item. for (int i = 0; i < specialMenuItems.length; i++) { specialMenuItems[i].setActionCommand( specialMenuItems[i].getText()); specialMenuItems[i].addActionListener(sml); _specialMenu.add(specialMenuItems[i]); } _menubar.add(_specialMenu); setJMenuBar(_menubar); getContentPane().add(plot, BorderLayout.CENTER); // FIXME: This should not be hardwired in here. setSize(500, 300); // Center. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); int x = (screenSize.width - frameSize.width) / 2; int y = (screenSize.height - frameSize.height) / 2; setLocation(x, y); }
Example 8
Source File: PlotFrame.java From opt4j with MIT License | 4 votes |
/** * Construct a plot frame with the specified title and the specified * instance of PlotBox. After constructing this, it is necessary to call * setVisible(true) to make the plot appear. * * @param title * The title to put on the window. * @param plotArg * the plot object to put in the frame, or null to create an * instance of Plot. */ public PlotFrame(String title, PlotBox plotArg) { super(title); // The Java look & feel is pretty lame, so we use the native // look and feel of the platform we are running on. try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { // Ignore exceptions, which only result in the wrong look and feel. } if (plotArg == null) { plot = new Plot(); } else { plot = plotArg; } // Background color is a light grey. plot.setBackground(new Color(0xe5e5e5)); _fileMenu.setMnemonic(KeyEvent.VK_F); _editMenu.setMnemonic(KeyEvent.VK_E); _specialMenu.setMnemonic(KeyEvent.VK_S); // File menu JMenuItem[] fileMenuItems = { new JMenuItem("Open", KeyEvent.VK_O), new JMenuItem("Save", KeyEvent.VK_S), new JMenuItem("SaveAs", KeyEvent.VK_A), new JMenuItem("Export", KeyEvent.VK_E), new JMenuItem("Print", KeyEvent.VK_P), new JMenuItem("Close", KeyEvent.VK_C), }; // Open button = ctrl-o. fileMenuItems[0].setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK)); // Save button = ctrl-s. fileMenuItems[1].setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); // Print button = ctrl-p. fileMenuItems[4].setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK)); // Close button = ctrl-w. fileMenuItems[5].setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK)); FileMenuListener fml = new FileMenuListener(); // Set the action command and listener for each menu item. for (int i = 0; i < fileMenuItems.length; i++) { fileMenuItems[i].setActionCommand(fileMenuItems[i].getText()); fileMenuItems[i].addActionListener(fml); _fileMenu.add(fileMenuItems[i]); } _menubar.add(_fileMenu); // Edit menu JMenuItem format = new JMenuItem("Format", KeyEvent.VK_F); FormatListener formatListener = new FormatListener(); format.addActionListener(formatListener); _editMenu.add(format); _menubar.add(_editMenu); // Special menu JMenuItem[] specialMenuItems = { new JMenuItem("About", KeyEvent.VK_A), new JMenuItem("Help", KeyEvent.VK_H), new JMenuItem("Clear", KeyEvent.VK_C), new JMenuItem("Fill", KeyEvent.VK_F), new JMenuItem("Reset axes", KeyEvent.VK_R), new JMenuItem("Sample plot", KeyEvent.VK_S), }; SpecialMenuListener sml = new SpecialMenuListener(); // Set the action command and listener for each menu item. for (int i = 0; i < specialMenuItems.length; i++) { specialMenuItems[i].setActionCommand(specialMenuItems[i].getText()); specialMenuItems[i].addActionListener(sml); _specialMenu.add(specialMenuItems[i]); } _menubar.add(_specialMenu); setJMenuBar(_menubar); getContentPane().add(plot, BorderLayout.CENTER); // FIXME: This should not be hardwired in here. setSize(500, 300); // Center. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); int x = (screenSize.width - frameSize.width) / 2; int y = (screenSize.height - frameSize.height) / 2; setLocation(x, y); }
Example 9
Source File: SearchAndAnnotatePanel.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
public FindFirstAction() { super("First"); super.putValue(SHORT_DESCRIPTION, "Finds the first occurrence."); super.putValue(MNEMONIC_KEY, KeyEvent.VK_F); }
Example 10
Source File: StyledEditor.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
private static boolean isFormat(KeyEvent ke) { return ke.isShiftDown() && ke.getKeyCode() == KeyEvent.VK_F; }
Example 11
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 12
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 13
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 14
Source File: ConstructionWizard.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Sets the new x and y location and facing of the site * @param s * @param c */ public void processKeyPress(ConstructionSite s, int c) { int facing = (int) s.getFacing(); double x = s.getXLocation(); double y = s.getYLocation(); if (c == KeyEvent.VK_UP // 38 || c == KeyEvent.VK_KP_UP || c == KeyEvent.VK_W || c == KeyEvent.VK_NUMPAD8) { upKeyPressed = true; } else if(c == KeyEvent.VK_DOWN // 40 || c == KeyEvent.VK_KP_DOWN || c == KeyEvent.VK_S || c == KeyEvent.VK_NUMPAD2) { downKeyPressed = true; } else if(c == KeyEvent.VK_LEFT // 37 || c == KeyEvent.VK_KP_LEFT || c == KeyEvent.VK_A || c == KeyEvent.VK_NUMPAD4) { leftKeyPressed = true; } else if(c == KeyEvent.VK_RIGHT // 39 || c == KeyEvent.VK_KP_RIGHT || c == KeyEvent.VK_D || c == KeyEvent.VK_NUMPAD6) { rightKeyPressed = true; } else if(c == KeyEvent.VK_R || c == KeyEvent.VK_F) { turnKeyPressed = true; } double w0 = s.getWidth(); double l0 = s.getLength(); double f0 = s.getFacing(); BoundedObject b0 = null; if (upKeyPressed) { b0 = new BoundedObject(s.getXLocation(), s.getYLocation() + 3, w0, l0, f0); if (!isCollided(b0)) s.setYLocation(y + 1); } if (downKeyPressed) { b0 = new BoundedObject(s.getXLocation(), s.getYLocation() - 3, w0, l0, f0); if (!isCollided(b0)) s.setYLocation(y - 1); } if (leftKeyPressed) { b0 = new BoundedObject(s.getXLocation() + 3, s.getYLocation(), w0, l0, f0); if (!isCollided(b0)) s.setXLocation(x + 1); } if (rightKeyPressed) { b0 = new BoundedObject(s.getXLocation() - 3, s.getYLocation(), w0, l0, f0); if (!isCollided(b0)) s.setXLocation(x - 1); } if (turnKeyPressed) { facing = facing + 45; if (facing >= 360) facing = facing - 360; b0 = new BoundedObject(s.getXLocation(), s.getYLocation(), w0, l0, facing); if (!isCollided(b0)) { s.setFacing(facing); } } }
Example 15
Source File: Patch.java From TrakEM2 with GNU General Public License v3.0 | 4 votes |
@Override public void keyPressed(final KeyEvent ke) { final Object source = ke.getSource(); if (! (source instanceof DisplayCanvas)) return; final DisplayCanvas dc = (DisplayCanvas)source; final Roi roi = dc.getFakeImagePlus().getRoi(); final int mod = ke.getModifiers(); switch (ke.getKeyCode()) { case KeyEvent.VK_C: // copy into ImageJ clipboard // Ignoring masks: outside is already black, and ImageJ cannot handle alpha masks. if (0 == (mod ^ (Event.SHIFT_MASK | Event.ALT_MASK))) { // Place the source image, untransformed, into clipboard: final ImagePlus imp = getImagePlus(); if (null != imp) imp.copy(false); } else if (0 == mod || (0 == (mod ^ Event.SHIFT_MASK))) { CoordinateTransformList<CoordinateTransform> list = null; if (hasCoordinateTransform()) { list = new CoordinateTransformList<CoordinateTransform>(); list.add(getCoordinateTransform()); } if (0 == mod) { //SHIFT is not down final AffineModel2D am = new AffineModel2D(); am.set(this.at); if (null == list) list = new CoordinateTransformList<CoordinateTransform>(); list.add(am); } ImageProcessor ip; if (null != list) { final TransformMesh mesh = new TransformMesh(list, meshResolution, o_width, o_height); final TransformMeshMapping mapping = new TransformMeshMapping(mesh); ip = mapping.createMappedImageInterpolated(getImageProcessor()); } else { ip = getImageProcessor(); } new ImagePlus(this.title, ip).copy(false); } ke.consume(); break; case KeyEvent.VK_F: // fill mask with current ROI using if (null != roi && M.isAreaROI(roi)) { Bureaucrat.createAndStart(new Worker.Task("Filling image mask") { @Override public void exec() { getLayerSet().addDataEditStep(Patch.this); if (0 == mod) { addAlphaMask(roi, ProjectToolbar.getForegroundColorValue()); } else if (0 == (mod ^ Event.SHIFT_MASK)) { // shift is down: fill outside try { final Area localRoi = M.areaInInts(M.getArea(roi)).createTransformedArea(at.createInverse()); final Area invLocalRoi = new Area(new Rectangle(0, 0, getOWidth() , getOHeight())); invLocalRoi.subtract(localRoi); addAlphaMaskLocal(invLocalRoi, ProjectToolbar.getForegroundColorValue()); } catch (final NoninvertibleTransformException e) { IJError.print(e); return; } } getLayerSet().addDataEditStep(Patch.this); try { updateMipMaps().get(); } catch (final Throwable t) { IJError.print(t); } // wait Display.repaint(); } }, project); } // capturing: ke.consume(); break; default: super.keyPressed(ke); break; } }