KeyEvent


3
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-5b75048d5041c407549420/] 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-5b75048d50423298291866/] TwitterFacebookLinkedinGoogle+Pinterestemail

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