File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Tab button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Tab button" Watch "Tab button" New topic

Tab button

Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
I am using actionPreformed(ActionEvent e) to trap when the Enter button is pressed from a JTextField. I would also like to catch the pressing of the tab button. Is there a FocusEvent ?
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Nigel,
Yes there is. The caveat is that you find out about it after the window system has completed the function:
FocusListener -->
Keep this in mind, and you will have no problems.
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Thanks for your reply Manfred. I was being lazy and didn't look up the FocusListener in the Docs. However, I am finding that my validation code is becoming massive is there a good design pattern for GUI validation?
I agree. Here's the link:
subject: Tab button
It's not a secret anymore!