Intermediate Java

Week 2 Review Questions

1. What are layout managers and what do they do?
Layout managers determine how the items that you put on a GUI are laid out on the GUI - where they are, and how large they are, and what sort of spacing is used between items.
2. True or False: In Swing, virtually all components are capable of holding other components
True
3. True or False: Different layout managers have the same policies for arranging components?
False
4. Briefly describe the differences between BorderLayout, FlowLayout and BoxLayout.
Border: arranges items in the border areas of the "page", assuming 5 possible areas - North ( top of page ) , South ( bottom of page) East ( left of page ) West ( right of page) and Center ( in the area between the north and south of page, if these exist, and in between the east and west of page, if these exist.)
Flow: arranges items from left to right until the "row" on the page is full, and them moves to the next row. Fills the GUI in the direction we read a book .
Box: Box layout lays items out along either the x-axis or the y-axis ( as you specify) and sizes them exactly according to your specs. It also allows you to create specifically-sized spaces between items.
5. Which layout manager deals with five regions: east, west, north, south, and center?
BORDER
6. Which layout manager keeps components stacked, even if there is room to put them side by side?
BOX
7. What does pack() method do?
It seems to be involved in attaching things to a frame
8. What is the default layout manager for a frame?
Border
9. What is the default layout manager for a panel?
Flow