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-5b75048f44614468200658/] 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-5b75048f4461c352062786/] TwitterFacebookLinkedinGoogle+Pinterestemail

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