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

The following examples show how to use java.awt.event.KeyEvent#KEY_LOCATION_RIGHT . 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: Keyboard.java    From OberonEmulator with ISC License 6 votes vote down vote up
public void press(int location, int keyCode) {
	if (keyCode == KeyEvent.VK_SHIFT) {
		shiftState = true;
		shiftToggled = false;
	}
	if (keyCode == KeyEvent.VK_ALT && location == KeyEvent.KEY_LOCATION_RIGHT) {
		// AltGr hack
		mmio.keyboardInput(ps2.encodeNative(KeyEvent.KEY_LOCATION_LEFT, KeyEvent.VK_CONTROL, false, false));
	}
	int[] scancodes = ps2.encodeNative(location, keyCode, true, false);
	if (scancodes.length > 0) {
		toggleShift(false);
		mmio.keyboardInput(scancodes);
	} else if (keyQueueOffset < keyQueue.length - 1){
		keyQueueOffset++;
		keyQueue[keyQueueOffset] = (keyCode << 16) | 1;
	}
}