Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create customised listener

 
sanjey asok
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a customized listener in Java, I explain as follow

I have a class A which has a property "name" as String type ,when the value of "name" is changed some method should be called.

So I want a listener to listen and catch the value change,How It can be done?
 
Geoff Jefferson
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your class so we can see?

 
Rob Spoor
Sheriff
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like a PropertyChangeListener would do. You can even use PropertyChangeSupport to do all the hard work for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic