Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Quiz

If your brain hasn't been turned into a GUI mush with this hour's toil, test your skills by answering the following questions.

Questions

  1. Which user component is used as a container to hold other components?
    1. TupperWare
    2. JPanel
    3. Choice
  2. Which of the following must be done first within a container?
    1. Establish a layout manager
    2. Add components
    3. Doesn't matter
  3. What part of a frame can contain other components?
    1. The whole frame
    2. None of the frame
    3. The frame's content pane

Answers

  1. b. JPanel. You can add components to the panel, then add the panel to another container such as a frame.
  2. a. You must specify the layout manager before the components so you can add them in the correct way.
  3. c. The pane is a Container object, and you call the object's add() method to add components to it.

Share ThisShare This

Informit Network