This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Events" Watch "Events" New topic
Author

Events

Aru
Ranch Hand

Joined: Jul 20, 2000
Posts: 112
Hi All,
Can anyone help me with this ?
If a component uses enableEvent() to handle a certain event mask, it may or may not use an Adapter as a listener for this event. True Or False

public class TestFrame extends Frame {
public TestFrame(String title) {
super(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}

public void processWindowEvent(WindowEvent we) {
System.out.println("Window event processed");
}
}
1. The window listener that has been addded to the TestFrame will be called on every window Object.
2. This code will compile & run if a window listener is added to an instance of TestFrame.
3. An exception is thrown if a window listener is added to TestFrame.
4. The window Listener that has been added to the TestFrame will never been called
5. This code will not compile if a window listenr is added to the TestFrame.
Can anyone explain ......why use enableEvents() instead of implementing the appropriate liseners...... ?
Thx in Advance
Aruna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Events
 
Similar Threads
IBM questions
A few doubts
About WindowListener
enableEvents
Event Handling