• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to do this

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic