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?
|
2: |
Which of the following must be done first within a container?
- Establish a layout manager
- Add components
- Doesn't matter
|
3: |
What method determines how components will be arranged within a container?
- setLayout()
- setLayoutManager()
- setVisible()
|
Answers
A1: |
b. JPanel. You can add components to the panel, and then add the panel to another container such as a frame.
|
A2: |
a. You must specify the layout manager before the components so you can add them in the correct way.
|
A3: |
a. The setLayout() method takes one argument: the layout manager object that has the job of deciding where components should be displayed.
|
|