This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
The moose likes Java in General and the fly likes Event Binding in Java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Event Binding in Java ?" Watch "Event Binding in Java ?" New topic

Event Binding in Java ?

Mansoor Akhtar

Joined: Jul 11, 2010
Posts: 12

I was wondering if we can somehow bind a set of Java events with the occurrence of a particular event?

For example, if a list item gets selected / or if a radio button gets selected, we want to perform a number of operations. One way is to take care of all the events (through listeners) that could selected the item and/or radio button.
The other more sophisticated way can be binding of the desired operations with the selection of the component. So that, once desired operations are implemented and registered with the (say) component's selection event, the programmer need not to worry any more.

There must be some binding mechanism in Java.

Hope that I am able to explain what I am looking for.
Thanks in advance.
Darryl Burke

Joined: May 03, 2008
Posts: 4952

I thinks you're looking for javax.swing.Action / AbstractAction

luck, db
There are no new questions, but there may be new answers.
Mansoor Akhtar

Joined: Jul 11, 2010
Posts: 12
Thanks for pointing in to right direction.
However, javax.swing.Action is limited to several Components.
Can you suggest something similar for JList and/or other components.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 43399
Go through the documentation for those Components etc, and you will find methods called addXXXListener. Those methods tell you which Listeners are considered appropriate to those classes.
Don't get me started about those stupid light bulbs.
subject: Event Binding in Java ?
jQuery in Action, 3rd edition