Java Code Examples for java.awt.event.KeyEvent#VK_N
The following examples show how to use
java.awt.event.KeyEvent#VK_N .
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: MainPanel.java From javagame with MIT License | 6 votes |
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { // �u���b�N�����ֈړ� block.move(Block.LEFT); } else if (key == KeyEvent.VK_RIGHT) { // �u���b�N���E�ֈړ� block.move(Block.RIGHT); } else if (key == KeyEvent.VK_DOWN) { // �u���b�N�����ֈړ� block.move(Block.DOWN); } else if (key == KeyEvent.VK_SPACE || key == KeyEvent.VK_UP) { // �u���b�N����] block.turn(); } else if (key == KeyEvent.VK_N) { // �o�[�u���b�N��\�� block.createBarBlock(); } repaint(); }
Example 2
Source File: MainPanel.java From javagame with MIT License | 6 votes |
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { // �u���b�N�����ֈړ� block.move(Block.LEFT); } else if (key == KeyEvent.VK_RIGHT) { // �u���b�N���E�ֈړ� block.move(Block.RIGHT); } else if (key == KeyEvent.VK_DOWN) { // �u���b�N�����ֈړ� block.move(Block.DOWN); } else if (key == KeyEvent.VK_SPACE || key == KeyEvent.VK_UP) { // �u���b�N����] block.turn(); } else if (key == KeyEvent.VK_N) { // �o�[�u���b�N��\�� block.createBarBlock(); } repaint(); }
Example 3
Source File: MainPanel.java From javagame with MIT License | 6 votes |
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { // �u���b�N�����ֈړ� block.move(Block.LEFT); } else if (key == KeyEvent.VK_RIGHT) { // �u���b�N���E�ֈړ� block.move(Block.RIGHT); } else if (key == KeyEvent.VK_DOWN) { // �u���b�N�����ֈړ� block.move(Block.DOWN); } else if (key == KeyEvent.VK_SPACE || key == KeyEvent.VK_UP) { // �u���b�N����] block.turn(); } else if (key == KeyEvent.VK_N) { // �o�[�u���b�N��\�� block.createBarBlock(); } repaint(); }
Example 4
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 5
Source File: YesNoDialog.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); IJ.setKeyDown(keyCode); if (keyCode==KeyEvent.VK_ENTER||keyCode==KeyEvent.VK_Y||keyCode==KeyEvent.VK_S) { /* yesPressed = true; closeDialog(); */ // PREVENTING unintentional saving of projects. TODO setup an auto save just like Blender, a .quit file with the contents of the last XML, without exporting images (but with their correct paths) (maybe as an .xml1, similar to the .blend1) } else if (keyCode==KeyEvent.VK_N || keyCode==KeyEvent.VK_D) { closeDialog(); } }
Example 6
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 7
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 8
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 9
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 10
Source File: NewCharacterSheetCommand.java From gcs with Mozilla Public License 2.0 | 4 votes |
private NewCharacterSheetCommand() { super(I18n.Text("New Character Sheet"), CMD_NEW_CHARACTER_SHEET, KeyEvent.VK_N); }
Example 11
Source File: SearchAndAnnotatePanel.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
public FindNextAction() { super("Next"); super.putValue(SHORT_DESCRIPTION, "Finds the next occurrence."); super.putValue(MNEMONIC_KEY, KeyEvent.VK_N); }
Example 12
Source File: InputHandler.java From JavaGame with GNU Affero General Public License v3.0 | 4 votes |
private void toggleKey(int keyCode, boolean isPressed) { if (!isIgnoreInput()) { if (keyCode == KeyEvent.VK_Z && isAzertyCountry || keyCode == KeyEvent.VK_W && !isAzertyCountry || keyCode == KeyEvent.VK_UP) { up.toggle(isPressed); } if (keyCode == KeyEvent.VK_Q && isAzertyCountry || keyCode == KeyEvent.VK_A && !isAzertyCountry || keyCode == KeyEvent.VK_LEFT) { left.toggle(isPressed); } if (keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_DOWN) { down.toggle(isPressed); } if (keyCode == KeyEvent.VK_D || keyCode == KeyEvent.VK_RIGHT) { right.toggle(isPressed); } } if (isIgnoreInput()) { up.toggle(false); down.toggle(false); left.toggle(false); right.toggle(false); } if (keyCode == KeyEvent.VK_M) { if(!toggleMusic){ Game.getBackgroundMusic().play(); print.print("Playing Music", PrintTypes.MUSIC); toggleMusic = true; } } if (keyCode == KeyEvent.VK_COMMA) { Game.getBackgroundMusic().stop(); if(toggleMusic) print.print("Stopping Music", PrintTypes.MUSIC); toggleMusic = false; } if (keyCode == KeyEvent.VK_W && isAzertyCountry || keyCode == KeyEvent.VK_Z && !isAzertyCountry) { // if (map == 0){ // Game.getGame().setMap("/levels/water_level.png"); // map++; // } else{ // Game.getGame().setMap("/levels/custom_level.png"); // map--; // } if (Game.getMap() == 2) { if (Game.isNpc()) { Game.setNpc(false); } Game.setChangeLevel(true); } } if (keyCode == KeyEvent.VK_N) { if (Game.getPlayer().isMoving()) { setIgnoreInput(true); int n = popup.Warn("Stop moving before spawning dummy AI"); if (n == 0) { setIgnoreInput(false); } return; } if (!Game.isNpc()) { Game.setNpc(true); Game.npcSpawn(); print.print("Dummy has been spawned", PrintTypes.GAME); } } if (keyCode == KeyEvent.VK_K) { if (Game.isNpc()) { Game.setNpc(false); Game.npcKill(); print.print("Dummy has been removed", PrintTypes.GAME); } } if (keyCode == KeyEvent.VK_A && isAzertyCountry || keyCode == KeyEvent.VK_Q && !isAzertyCountry) this.quitGame(); if (keyCode == KeyEvent.VK_BACK_QUOTE) { if (!Game.isClosing() && !Game.isDevMode()) { Game.setDevMode(true); new Thread(new SleepThread()); } } }
Example 13
Source File: NewPetriNetAction.java From PIPE with MIT License | 4 votes |
/** * Constructor * @param applicationController main PIPE application controller */ public NewPetriNetAction(PipeApplicationController applicationController) { super("New", "Create a new Petri net", KeyEvent.VK_N, InputEvent.META_DOWN_MASK); this.applicationController = applicationController; }
Example 14
Source File: MainFrame.java From uima-uimaj with Apache License 2.0 | 4 votes |
/** * Creates the file menu. */ private void createFileMenu() { this.fileMenu = new JMenu("File"); // Standard text file menu items. JMenuItem newTextItem = new JMenuItem("New Text...", KeyEvent.VK_N); newTextItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); newTextItem.addActionListener(new NewTextEventHandler(this)); this.fileMenu.add(newTextItem); this.fileMenu.setMnemonic(KeyEvent.VK_F); JMenuItem fileOpen = new JMenuItem("Open Text File", KeyEvent.VK_O); fileOpen.addActionListener(new FileOpenEventHandler(this)); fileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); this.fileMenu.add(fileOpen); this.fileSaveItem = new JMenuItem("Save Text File", KeyEvent.VK_S); this.fileSaveItem.setEnabled(false); this.fileSaveItem.addActionListener(new FileSaveEventHandler(this)); this.fileSaveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); this.fileMenu.add(this.fileSaveItem); JMenuItem fileSaveAsItem = new JMenuItem("Save Text As...", KeyEvent.VK_A); fileSaveAsItem.addActionListener(new FileSaveAsEventHandler(this)); this.fileMenu.add(fileSaveAsItem); createCPMenu(); this.cpMenu.setMnemonic(KeyEvent.VK_P); this.fileMenu.add(this.cpMenu); this.fileMenu.addSeparator(); this.recentTextFileMenu = new JMenu("Recently used ..."); this.recentTextFileMenu.setMnemonic(KeyEvent.VK_U); this.fileMenu.add(this.recentTextFileMenu); this.fileMenu.addSeparator(); // Color preferences JMenuItem colorPrefsOpenItem = new JMenuItem("Load Color Settings", KeyEvent.VK_L); colorPrefsOpenItem.addActionListener(new ColorPrefsOpenHandler(this)); this.fileMenu.add(colorPrefsOpenItem); JMenuItem colorPrefsSaveItem = new JMenuItem("Save Color Settings", KeyEvent.VK_C); colorPrefsSaveItem.addActionListener(new ColorPrefsSaveHandler(this)); this.fileMenu.add(colorPrefsSaveItem); this.fileMenu.addSeparator(); // Reading and writing type system files. this.typeSystemReadItem = new JMenuItem("Read Type System File"); this.typeSystemReadItem.setEnabled(true); this.typeSystemReadItem.addActionListener(new TypeSystemFileOpenEventHandler(this)); this.fileMenu.add(this.typeSystemReadItem); this.typeSystemWriteItem = new JMenuItem("Write Type System File"); this.typeSystemWriteItem.addActionListener(new XCASSaveTSHandler(this)); this.fileMenu.add(this.typeSystemWriteItem); this.fileMenu.addSeparator(); // Reading and writing XMI CAS files. this.xmiCasReadItem = new JMenuItem("Read XMI CAS File"); this.xmiCasReadItem.addActionListener(new XmiCasFileOpenHandler(this)); this.fileMenu.add(this.xmiCasReadItem); this.xmiCasWriteItem = new JMenuItem("Write XMI CAS File"); this.xmiCasWriteItem.addActionListener(new XmiCasSaveHandler(this)); this.fileMenu.add(this.xmiCasWriteItem); this.fileMenu.addSeparator(); // Reading and writing old-style XCAS files. this.xcasReadItem = new JMenuItem("Read XCAS File", KeyEvent.VK_R); this.xcasReadItem.addActionListener(new XCASFileOpenEventHandler(this)); this.fileMenu.add(this.xcasReadItem); this.xcasWriteItem = new JMenuItem("Write XCAS File", KeyEvent.VK_W); this.xcasWriteItem.addActionListener(new XCASSaveHandler(this)); this.fileMenu.add(this.xcasWriteItem); this.fileMenu.addSeparator(); JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X); exit.addActionListener(new SystemExitHandler(this)); this.fileMenu.add(exit); // Disable menu items that can't be executed yet. this.typeSystemWriteItem.setEnabled(false); setEnableCasFileReadingAndWriting(); }
Example 15
Source File: NamedColorPanel.java From constellation with Apache License 2.0 | 4 votes |
@Override public int getMnemonic() { return KeyEvent.VK_N; }
Example 16
Source File: NoopAction.java From PIPE with MIT License | 2 votes |
/** * Constructor * @param applicationModel PIPE application model */ public NoopAction(PipeApplicationModel applicationModel) { super("Noop", "Noop", KeyEvent.VK_N, InputEvent.ALT_DOWN_MASK, applicationModel); }
Example 17
Source File: AnnotationAction.java From PIPE with MIT License | 2 votes |
/** * Action constructor * @param applicationModel model of the entire application model */ public AnnotationAction(PipeApplicationModel applicationModel) { super("Annotation", "Add an annotation (alt-N)", KeyEvent.VK_N, InputEvent.ALT_DOWN_MASK, applicationModel); }