aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
 
subject: Events