Chapter 7
Additional Web Questions
Please answer the following true or false questions:
1. Containers like JPanel and Panel control their contents layout.
2. A container's layout manager is fixed and cannot be changed.
3. Layout managers cannot be combined.
4. A BorderLayout has five regions.
5. You must use all regions of a BorderLayout.
6. A GridLayout manger also uses a GridBagConstraints object.
7. GridBagContraints cannot be reused.
8. A layout manager will resize the components when their parent window is resized.
9. Components are added to the layout manager with the add() method.
10. All components managed by a GridLayout are the same size.
Answes:
1. false.
Layout managers control the container's layout of its contents. Containers are assigned a layout manager.
2. false.
A container's layout manager can be changed at any time using the setLayout() method.
3. false.
Layout managers can be combined. While a container can only have one layout manager, containers can contain other containers, each with their own layout manager. The end result is that several layout managers have been combined to create the overall layout.
4.true.
The five regions are NORTH, SOUTH, WEST, EAST, and CENTER.
5. false.
Any unused region doesn't take up any space.
6. false.
A GridBagLayout uses GridBagConstraints.
7. false.
GridBagConstraints can be reused, modified, and reused again and again.
8. true.
The primary purpose of a layout manager is to resize and reshape components.
9. false.
Trick question. Components are added to a CONTAINER using the add() method. Nothing is actually added to the layout manager.
10. true.
It wouldn't be much of a grid if everything were different sizes!