Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can I know the Event take place??

 
leo tien
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for example ,ActionListener\ActionEvent:
when I add the ActionListener to the component(a button),after I press it ,it call actionPerformed() method. This is because take place ActionEvent.But in my own Listener and Event(E.G.ModelChangeListener,ModelChangeEvent),I can put the modelChange() method to the fireModelChangeListener() method, then when the model is changed ,will call fireModelChangedListener() autometicly.So the ModelChangeEvent can throw away.
I want to know when must need the EventObject and how do it's work???
Thanks.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

.But in my own Listener and Event(E.G.ModelChangeListener,ModelChangeEvent),I can put the modelChange() method to the fireModelChangeListener() method, then when the model is changed ,will call fireModelChangedListener() autometicly

Not unless you explicitely call your fireModelChangeListener() method from the appropriate place in your model. For example:

Eugene.
 
leo tien
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes Eugene.But which condition must need Event?
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

yes Eugene.But which condition must need Event?

Do you mean, which condition should trigger an event? Well, a change in the model would be a good example of such a a condition.
Eugene.
 
leo tien
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, yes. thanks Eugene.
just because I stick in the mud.
E.G.:I add a ActionListener to the component(a Button), when I prees the Button ,take place the ActionEvent .And put it into actionPerformed() method as a parameter.But if it necessary??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic