CS 151 Day 10

Cover page image

Cay S. Horstmann

Day 10 Clicker Question 1

How do you lay out components in a Swing user interface?

  1. By dragging and dropping them to the desired place, using a GUI builder tool
  2. By specifiying the layout in a text file that is loaded when the GUI is initialized
  3. By writing Java code that places the elements in rows and columns of a grid
  4. By implementing a layout manager

Day 10 Clicker Question 2

The Arrays.sort(Object[]) method can sort an array of any objects whose classes implement the Comparable interface type. Of which design pattern is this an example?

  1. STRATEGY
  2. DECORATOR
  3. COMPOSITE
  4. None of the above

Day 10 Clicker Question 3

When the COMPOSITE design pattern is applied to Swing containers, a Swing component is a

  1. Container
  2. Composite
  3. Primitive
  4. Leaf

Lab

lab

Pattern Discussion

Composite vs. Decorator

A Decorator

Unmodifiable Lists

Discussion

discussion