Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

how can I know the Event take place??

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
reply
    Bookmark Topic Watch Topic
  • New Topic