GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Is it possible to do this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Is it possible to do this" Watch "Is it possible to do this" New topic
Author

Is it possible to do this

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I have several JTextfields which need to be populated.These
amounts in the end need to be calculated, the way I have things now the user needs to press enter at the end of filling each field; Is there some way to listen to when the user has left one textfield and gone on to the next.
thanks 4 all your time
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Yes... look into the FocusListener class... it supports the focusLost(FocusEvent) and focusGained(FocusEvent) methods. You will be interested in focusLost(). Just add a FocusListener to each textfield, and you'll be ready to go. It gets launched whenever the user does something to get out of the textfield( i.e. clicks on another field with the mouse or tabs out of it ).

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
GeeCON Prague 2014
 
subject: Is it possible to do this