A good answer might be:

Yes—the system does not know which events will be ignored, so must create an event object for each one. GUI programs are computationally intense.

WindowAdapter Class

A WindowAdapter object is an event listener for window (ie. frame) events. The class has listener methods for every frame event. By default, these listener methods receive the event but then do nothing. To create a listener for a frame object do this:

  1. Create a listener object:
    • Extend WindowAdapter to create a child class.
    • For each type of event you need to respond to, override the corresponding method in WindowAdapter.
    • Use new to construct a listener object.
  2. Register the listener with the frame object:
    • Construct the frame object.
    • Use addWindowListener() to register the listener with the frame.

Registering a listener with a frame means connecting the two objects so that events from one object (the frame) are sent to the other (the listener). This is done with the addWindowListener() method.

QUESTION 5:

Where is addWindowListener() called?

  1. In the JFrame class?
  2. In the WindowAdapter class?