This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Applets and the fly likes applet action listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "applet action listener" Watch "applet action listener" New topic

applet action listener

krishna krottapalli

Joined: Apr 05, 2014
Posts: 1

my scenario is a s below:

i have an applet with 10 fields in it. i need an action listener such that when you click on a particular field, a variable should be assigned to a value. once the cursor is out of the same field, the variable should be re assigned to the old/default value.
i am able to code the assigning part. please help in re-assigning the variable to old or default value once anything is clicked or selected out of that field.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

If these are text fields, then the "action listener" you're looking for is a Focus Listener. The events it supports are "focus gained" and "focus lost", which are what you described. The tutorial is here: How to Write a Focus Listener.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

And, welcome to the Ranch!
I agree. Here's the link:
subject: applet action listener
jQuery in Action, 3rd edition