This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.