A good answer might be:

Sure. A Frame is a container, and can hold many GUI components.

Two Buttons in a Frame

Let's develop a new program:
  • A frame will hold two buttons, one labeled "Red" and the other "Green."
    • The FlowLayout layout manager will be used so the buttons will be nicely positioned in the frame.

  • When the button marked "Red" is clicked, the background will turn red.

  • When the button marked "Green" is clicked, the background will turn green.
    • There will be an event listener that "listens" to the clicks from both buttons.

  • When the "close button" of the frame is clicked, the application will quit.
    • There will be an event listener that "listens" window events.

This is very close to a previous example program. It would be sensible to copy that file and edit it for the new application. However, as a review of these somewhat confusing GUI implementation details, let us start from scratch.

QUESTION 3:

Read the description again and decide on the following:

  1. How many container objects will there be?
  2. What GUI component objects will it contain?
  3. What objects generate events?
  4. What objects will receive the events?

Click Here after you have answered the question