CSC152 2005S, Class 23: Fun with Text, Continued Admin: * Questions on the exam? * What does the first question mean? Overview: * Review of goals * Summary of new code * Lab! Goal: Build a collection of classes that let us make "interesting" layouts of text. * Simple class: TextLine (part or all of line) * Abstraction: TextBlock (possibly multiple lines) * Wrapper: SurroundedText (surround a block with stars, giving us a new block) * Compound object: SimpleTextBlock (no more than three lines) Learning outcome from yesterday: If we design the abstraction TextBlock and make SurroundedText and TextLine and SimpleTextBlock all implement it, we can more easily compose things (e.g., surround surroundedtext) Implication: When we build ComposeHorizontally, ComposeVertically, and the ilk we can also make them implement TextBlock and we can therefore make interesting compound layouts What Sam did in preparation for this class: * TextLine now implements TextBlock * Write "implements TextBlock" * Implement three methods: * getWidth: Already implemented by looking at the length of the string * getLines: return 1 * getLine: Make sure that the parameter is 0, return the current TextLine * TextLine now includes "String atWidth(int width)" * Wrote all of ComposeVertically * Wrote most of ComposeHorizontally * Fails to work if the first block is shorter than the second Today's lab goals * Part 1: Setup Make: rebelsky/text Copy: ComposeHorizontally (to fix) Copy: TestText (to play) * Part 2: Fun Build some interesting composition * Part 3: Correct Verify that it's incorrect Fix ComposeHorizontally * Part 4: Extend Write Center * Part 5: Extend more Write some other useful class