Adding a KeyListener to a JTextField to detect KeyPressed events is pretty straightforward. Buy maybe you have encountered some problems when trying to detect special key such as TAB’s. This issue is due to LowLevel keyEvents captured by Swing’s default FocusTraversalKeys. What we need to do to capture the VK_TAB KeyEvent is to remove the default FocusTraversalKeys from the component. [crayon-60d3134996045119407523/] Once we’ve done this with the component, the tab KeyEvent will not be captured by swing’s default focus traversal keys and we will be able to add events normally. [crayon-60d3134996050166868411/] TwitterFacebookLinkedinPinterestemail

Detecting Tab Key Pressed Event in JTextField ‘s // Event.VK_TAB ...