File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Listeners" Watch "Listeners" New topic
Author

Listeners

Sagar Dabas
Ranch Hand

Joined: Nov 15, 2011
Posts: 47

Does event sources are registered with only one object of a listener? No new listener's object is created every time when a user clicks a button.

This program appends the string with a new incremented character when user clicks on the button.
'build' is the instance variable of the listener class. 'build' remembers its previous value and appends the new value when user clicks the button that means no new listener object is created. Only the function actionPerformed() is invoked on the same object..

Am I correct ?



Live Curious!!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38436
    
  23
Yes, I think you are correct.
I quite enjoyed running your little application with abcde
Sagar Dabas
Ranch Hand

Joined: Nov 15, 2011
Posts: 47

Thanks....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listeners