jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes enableEvents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "enableEvents" Watch "enableEvents" New topic


Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
what really does this code:
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.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

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.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link: http://aspose.com/file-tools
subject: enableEvents
jQuery in Action, 3rd edition