File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 5115

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: 46349
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.
I agree. Here's the link:
subject: Event Binding in Java ?
It's not a secret anymore!