Java AWT KeyEvent is action key
import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JTextField; public class Main { public static void main(String[] args) { JFrame frame = new JFrame("Window Title"); frame.setBounds(50, 100, 300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextField typingArea = new JTextField(20); typingArea.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { displayInfo(e, "KEY TYPED: "); }/*from ww w. j ava 2 s. c om*/ public void keyPressed(KeyEvent e) { displayInfo(e, "KEY PRESSED: "); } public void keyReleased(KeyEvent e) { displayInfo(e, "KEY RELEASED: "); } protected void displayInfo(KeyEvent e, String s) { if (e.isActionKey()) { System.out.println("action key Yes "); } else { System.out.println("action key No "); } } }); frame.add(typingArea); frame.setVisible(true); } }