Prototype (Chapter 18)

SOLUTION 18.1Figure B.23 shows a solution. Note that this class is concrete. You will soon establish instances of this class as complete user interface factories.
Figure B.23. A UIKit object is a wellspring of GUI components that have a consistent look.

SOLUTION 18.2Here is an example solution:
public static UIKit handheld()
{
    UIKit k = new UIKit();
    Font f = new Font("Dialog", Font.PLAIN, 8);
    k.button.setFont(f);
    k.textArea.setFont(f);
    Cursor c = new Cursor(Cursor.HAND_CURSOR);
    k.textArea.setCursor(c);
    return k;
}

The object k is a kit that can create components suitable for a handheld display.

SOLUTION 18.3The comment ...

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.