Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Events

 
Aru
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic