Java Code Examples for java.awt.event.KeyEvent#VK_Q

The following examples show how to use java.awt.event.KeyEvent#VK_Q . 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: OptionsDialogTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreDefaultsForKeybindings() throws Exception {
	String actionName = "Clear Cut";
	String pluginName = "DataTypeManagerPlugin";
	KeyStroke defaultKeyStroke = getKeyBinding(actionName);
	assertOptionsKeyStroke(actionName, pluginName, defaultKeyStroke);

	int keyCode = KeyEvent.VK_Q;
	int modifiers = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;
	KeyStroke newKeyStroke = setKeyBinding(actionName, modifiers, keyCode, 'Q');

	apply();
	assertOptionsKeyStroke(actionName, pluginName, newKeyStroke);

	restoreDefaults();

	KeyStroke currentBinding = getKeyBinding(actionName);
	assertEquals("Key binding not restored after a call to restore defautls", defaultKeyStroke,
		currentBinding);
	assertOptionsKeyStroke(actionName, pluginName, defaultKeyStroke);
}
 
Example 2
Source File: OptionsDialogTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreDefaultsForFrontEndKeybindings() throws Exception {
	runSwing(() -> dialog.close());

	setUpDialog(env.getFrontEndTool());

	String actionName = "Archive Project";
	String pluginName = "ArchivePlugin";
	KeyStroke defaultKeyStroke = getKeyBinding(actionName);
	assertOptionsKeyStroke(actionName, pluginName, defaultKeyStroke);

	int keyCode = KeyEvent.VK_Q;
	int modifiers = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK;
	KeyStroke newKeyStroke = setKeyBinding(actionName, modifiers, keyCode, 'Q');

	apply();
	assertOptionsKeyStroke(actionName, pluginName, newKeyStroke);

	restoreDefaults();

	KeyStroke currentBinding = getKeyBinding(actionName);
	assertEquals("Key binding not restored after a call to restore defautls", defaultKeyStroke,
		currentBinding);
	assertOptionsKeyStroke(actionName, pluginName, defaultKeyStroke);
}
 
Example 3
Source File: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static boolean usableKeyOnMac(int key, int mask) {
    //All permutations fail for Q except ctrl
    if (key == KeyEvent.VK_Q) {
        return false;
    }

    boolean isMeta = ((mask & KeyEvent.META_MASK) != 0) || ((mask & KeyEvent.CTRL_DOWN_MASK) != 0);

    boolean isAlt = ((mask & KeyEvent.ALT_MASK) != 0) || ((mask & KeyEvent.ALT_DOWN_MASK) != 0);

    boolean isOnlyMeta = isMeta && ((mask & ~(KeyEvent.META_DOWN_MASK | KeyEvent.META_MASK)) == 0);

    //Mac OS consumes keys Command+ these keys - the app will never see
    //them, so CTRL should not be remapped for these
    if (isOnlyMeta) {
        return (key != KeyEvent.VK_H) && (key != KeyEvent.VK_SPACE) && (key != KeyEvent.VK_TAB);
    }
    if ((key == KeyEvent.VK_D) && isMeta && isAlt) {
        return false;
    }
    if (key == KeyEvent.VK_SPACE && isMeta && ((mask & KeyEvent.CTRL_MASK) != 0)) {
        // http://lists.apple.com/archives/java-dev/2010/Aug/msg00002.html
        return false;
    }
    return true;
}
 
Example 4
Source File: MasterCli.java    From brModelo with GNU General Public License v3.0 6 votes vote down vote up
public boolean processeAtalhos(int keyCode) {
    boolean res = false;
    switch (keyCode) {
        case KeyEvent.VK_V:
            doPaste();
            res = true;
            break;
        case KeyEvent.VK_Q:
            Sair();
            res = true;
            break;
        case KeyEvent.VK_D:
            Cancelar();
            res = true;
            break;
    }
    return res;
}
 
Example 5
Source File: KeyboardSupport.java    From CrossMobile with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 6
Source File: QuitCommand.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
private QuitCommand() {
    super(Platform.isMacintosh() ? I18n.Text("Quit") : I18n.Text("Exit"), CMD_QUIT, KeyEvent.VK_Q);
}
 
Example 7
Source File: ExitAction.java    From PIPE with MIT License 4 votes vote down vote up
public ExitAction(Frame application, PipeApplicationController pipeApplicationController) {
    super("Exit", "Close the program", KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    this.application = application;
    this.pipeApplicationController = pipeApplicationController;
}
 
Example 8
Source File: InputHandler.java    From JavaGame with GNU Affero General Public License v3.0 4 votes vote down vote up
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 9
Source File: DQ.java    From javagame with MIT License 4 votes vote down vote up
/**
 * �L�[�������ꂽ��L�[�̏�Ԃ��u�����ꂽ�v�ɕς���
 * 
 * @param e �L�[�C�x���g
 */
public void keyPressed(KeyEvent e) {
    int keyCode = e.getKeyCode();

    // �I������
    if (keyCode == KeyEvent.VK_ESCAPE || keyCode == KeyEvent.VK_Q ||
            keyCode == KeyEvent.VK_END ||
            (keyCode == KeyEvent.VK_C && e.isControlDown())) {
        running = false;
    }

    if (keyCode == KeyEvent.VK_LEFT) {
        if (commandWindow.isVisible()) {
            cmdLeftKey.press();
        } else {
            leftKey.press();
        }
    }
    if (keyCode == KeyEvent.VK_RIGHT) {
        if (commandWindow.isVisible()) {
            cmdRightKey.press();
        } else {
            rightKey.press();
        }
    }
    if (keyCode == KeyEvent.VK_UP) {
        if (commandWindow.isVisible()) {
            cmdUpKey.press();
        } else {
            upKey.press();
        }
    }
    if (keyCode == KeyEvent.VK_DOWN) {
        if (commandWindow.isVisible()) {
            cmdDownKey.press();
        } else {
            downKey.press();
        }
    }
    if (keyCode == KeyEvent.VK_SPACE) {
        spaceKey.press();
    }
}
 
Example 10
Source File: View2D.java    From energy2d with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void processKeyReleased(KeyEvent e) {
	if (runHeatingThread) {
		if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
			cooling = false;
		}
	}
	switch (e.getKeyCode()) {
	case KeyEvent.VK_DELETE:
	case KeyEvent.VK_BACK_SPACE:
		// this is different than cut() in that it doesn't create a copy for pasting
		if (selectedManipulable != null) {
			if (JOptionPane.showConfirmDialog(this, "Are you sure you want to delete the selected object?", "Delete Object", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
				undoManager.addEdit(new UndoRemoveManipulable(this));
				notifyManipulationListeners(selectedManipulable, ManipulationEvent.DELETE);
				setSelectedManipulable(null);
			}
		} else {
			if (showGraph) {
				if (JOptionPane.showConfirmDialog(this, "Are you sure you want to erase the graph?", "Erase Graph", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
					eraseGraph();
				}
			}
		}
		break;
	case KeyEvent.VK_R:
		notifyManipulationListeners(null, runToggle ? ManipulationEvent.STOP : ManipulationEvent.RUN);
		break;
	case KeyEvent.VK_T:
		notifyManipulationListeners(null, ManipulationEvent.RESET);
		break;
	case KeyEvent.VK_L:
		notifyManipulationListeners(null, ManipulationEvent.RELOAD);
		break;
	case KeyEvent.VK_S: // avoid conflict with the save keystroke
		if (!e.isControlDown() && !e.isMetaDown() && !e.isAltDown())
			notifyManipulationListeners(null, ManipulationEvent.SUN_SHINE);
		break;
	case KeyEvent.VK_Q:
		notifyManipulationListeners(null, ManipulationEvent.SUN_ANGLE_INCREASE);
		break;
	case KeyEvent.VK_W:
		notifyManipulationListeners(null, ManipulationEvent.SUN_ANGLE_DECREASE);
		break;
	case KeyEvent.VK_G:
		showGraph = !showGraph;
		notifyGraphListeners(showGraph ? GraphEvent.GRAPH_OPENED : GraphEvent.GRAPH_CLOSED);
		break;
	case KeyEvent.VK_ESCAPE: // allow the app to shut down when in full screen mode
		Object r = getClientProperty("close_full_screen");
		if (r instanceof Runnable)
			((Runnable) r).run();
		break;
	}
	repaint();
	tipText = null;
	// e.consume();//don't call, or this stops key binding
}
 
Example 11
Source File: MissingCharsKorean.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static boolean setKeyInput(int iCount) {
    boolean inputSet = true;

    switch(iCount) {
        case 0:
            // Input Korean q (#12610) /(#47)
            expectedResults = new int[]{ 12610, 47 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH}
                                    };
            break;

        case 1:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 2:
            // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
            expectedResults = new int[]{ 12610, 47, 54857, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 3:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 4:
            // Input Korean q (#12610) /(#47) g (#12622) \(#92)
            expectedResults = new int[]{ 12610, 47, 12622, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        default:
            inputSet = false;
            break;
    }

    return inputSet;
}
 
Example 12
Source File: KeyCodeToChar.java    From Repeat with Apache License 2.0 4 votes vote down vote up
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: KeyCodeToChar.java    From Repeat with Apache License 2.0 4 votes vote down vote up
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 14
Source File: Robot.java    From xnx3 with Apache License 2.0 4 votes vote down vote up
/**
 * 将字符型转换为按键码,可直接使用 {@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 15
Source File: MissingCharsKorean.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static boolean setKeyInput(int iCount) {
    boolean inputSet = true;

    switch(iCount) {
        case 0:
            // Input Korean q (#12610) /(#47)
            expectedResults = new int[]{ 12610, 47 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH}
                                    };
            break;

        case 1:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 2:
            // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
            expectedResults = new int[]{ 12610, 47, 54857, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 3:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 4:
            // Input Korean q (#12610) /(#47) g (#12622) \(#92)
            expectedResults = new int[]{ 12610, 47, 12622, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        default:
            inputSet = false;
            break;
    }

    return inputSet;
}
 
Example 16
Source File: MissingCharsKorean.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static boolean setKeyInput(int iCount) {
    boolean inputSet = true;

    switch(iCount) {
        case 0:
            // Input Korean q (#12610) /(#47)
            expectedResults = new int[]{ 12610, 47 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH}
                                    };
            break;

        case 1:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 2:
            // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
            expectedResults = new int[]{ 12610, 47, 54857, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 3:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 4:
            // Input Korean q (#12610) /(#47) g (#12622) \(#92)
            expectedResults = new int[]{ 12610, 47, 12622, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        default:
            inputSet = false;
            break;
    }

    return inputSet;
}
 
Example 17
Source File: MissingCharsKorean.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static boolean setKeyInput(int iCount) {
    boolean inputSet = true;

    switch(iCount) {
        case 0:
            // Input Korean q (#12610) /(#47)
            expectedResults = new int[]{ 12610, 47 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH}
                                    };
            break;

        case 1:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 2:
            // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
            expectedResults = new int[]{ 12610, 47, 54857, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 3:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 4:
            // Input Korean q (#12610) /(#47) g (#12622) \(#92)
            expectedResults = new int[]{ 12610, 47, 12622, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        default:
            inputSet = false;
            break;
    }

    return inputSet;
}
 
Example 18
Source File: MissingCharsKorean.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static boolean setKeyInput(int iCount) {
    boolean inputSet = true;

    switch(iCount) {
        case 0:
            // Input Korean q (#12610) /(#47)
            expectedResults = new int[]{ 12610, 47 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH}
                                    };
            break;

        case 1:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 2:
            // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
            expectedResults = new int[]{ 12610, 47, 54857, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 3:
            // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
            expectedResults = new int[]{ 12610, 47, 54840, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        case 4:
            // Input Korean q (#12610) /(#47) g (#12622) \(#92)
            expectedResults = new int[]{ 12610, 47, 12622, 92 };
            inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
                                        {KeyEvent.VK_SLASH},
                                        {KeyEvent.VK_G},
                                        {KeyEvent.VK_H},
                                        {KeyEvent.VK_Q},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SPACE},
                                        {KeyEvent.VK_BACK_SLASH}
                                    };
            break;

        default:
            inputSet = false;
            break;
    }

    return inputSet;
}
 
Example 19
Source File: AppletFrame.java    From pdfxtk with Apache License 2.0 3 votes vote down vote up
public AppletFrame(String title, 
     Applet applet_, 
     int width, int height) {
  super("applet", title);
  addWindowListener(this);
  applet = applet_;
  
  MenuBar  menubar = new MenuBar();
  Menu     file    = new Menu("File", true);
  MenuItem quit    = new MenuItem("Quit", new MenuShortcut(KeyEvent.VK_Q));

  setBackground(Color.lightGray);

  quit.addActionListener(this);
  
  menubar.add(file);
  file.add(quit);
  setMenuBar(menubar);
  
  add("Center", applet);

  setSize(width, height);

  applet.init();

  setVisible(true);
  
  validate();

  applet.active = true;
  applet.start();

  validate();
}