my dog learned polymorphism*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Event Binding in Java ?" Watch "Event Binding in Java ?" New topic
Author

Event Binding in Java ?

Mansoor Akhtar
Greenhorn

Joined: Jul 11, 2010
Posts: 12
Hi,

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
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 38020
    
  22
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: http://aspose.com/file-tools
 
subject: Event Binding in Java ?
 
Similar Threads
deselecting radio button
Event Tag
want to get the value of selected radio button
Can't do multiple selections
Java Script Onclick event with pre selected radio buttons