public void keyReleased(KeyEvent E) { if (E.getKeyCode() == E.VK_ENTER) { if (E.getSource() == dismissButton) { dispose(); return; } } if (E.getKeyCode() == E.VK_TAB) { if (E.getSource() == textArea) { // Tab out of the text area textArea.transferFocus(); return; } } }