File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes VK_TAB event not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "VK_TAB event not working" Watch "VK_TAB event not working" New topic
Author

VK_TAB event not working

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Ok, here is my code

However, when I press the tab key while on that text field, nothing is printed out. Does anyone know why?
[ July 11, 2002: Message edited by: Gregg Bolinger ]

GenRocket - A Test Data Generation Platform
Rene Liebmann
Ranch Hand

Joined: May 02, 2002
Posts: 196
Hi Gregg,
I don't know why this happens, but if you want to catch this event to know, that the JTextField will lose the focus, then I would better do it with a FocusListener.
Anyway, it is strange. I could imagine that the Focus behavior will catch the key event somehow. And then the key event will be lost.
Rene
[ July 11, 2002: Message edited by: Rene Liebmann ]
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I think the event is being consumed in the InputMap of the JTextArea...

look at this bug report on Sun's site... down in the "Evaluation" section it shows an example of setting things in the InputMap... maybe you could clear out the InputMap of your JTextArea or replace the action that is invoked in the InputMap?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Actually I figured it out. YOu have to disable the traversable tabbing event and just handle it yourself. So when you press tab, you capture the keyPressed Event, and after you do whatever you do, you handle going to the next focusable component you want it to go to.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: VK_TAB event not working
 
Similar Threads
Probelm with KeyListener
Tab Key and KeyListeners
FocusTraversalKeys challenge
NextFocusableComponent -> FocusTraversalPolicy
KeyListener && KeyEvents