• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

enableEvents

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what really does this code:
enableEvents(AWTEvent.ACTION_EVENT_MASK);
???
I saw it in a code. It also had a method called processActionEvent, but the class did not implement actionListener. Could someone clarify?

thanks in advance.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the low-level way that AWT processes events... All events aren't enabled for all components, that's why only some components can have ActionListeners added to them, and that's why you have to call enableEvents(), to enable to component to handel that class of events. All components also have a generic processEvent() method. This method calls processXXXEvent() methods based on what type of event it gets. So processActionEvent() gets sent all ActionEvents. Normally, this method would handle ActionEvents by handing them off to ActionListeners attached to them. Instead, the behavior is written right there in the method. Basically, this "hardcodes" behavior into the component that can't be overridden by a listener.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic