how to test for key press java code example Example: check key is pressed java if (evt. getKeyCode() == KeyEvent. VK_SHIFT)