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

The following examples show how to use java.awt.event.KeyEvent#VK_F3 . 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: Window.java    From Snake with GNU General Public License v3.0 5 votes vote down vote up
@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 2
Source File: ReadKeyCodesTest.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: ProjectToolbar.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
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 4
Source File: ActionUtils.java    From workcraft with MIT License 4 votes vote down vote up
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 5
Source File: VncClientPacketSender.java    From cosmic with Apache License 2.0 4 votes vote down vote up
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 6
Source File: KeyCodesTest.java    From openmeetings with Apache License 2.0 4 votes vote down vote up
@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 7
Source File: GOSwingEventConverter.java    From settlers-remake with MIT License 4 votes vote down vote up
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 8
Source File: VncClientPacketSender.java    From cloudstack with Apache License 2.0 4 votes vote down vote up
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;
}