March 2002
Intermediate to advanced
496 pages
8h 51m
English
| SOLUTION 10.1 | Figure B.12 shows a solution. The arrowheads in the link between PlaceA-Tub and PlaceATubMediator emphasize two-way navigability between these classes. A PlaceATub object has a mediator that it registers for events:
public JTextField textField()
{
if (textField == null)
{
textField = new JTextField();
textField.setFont(font());
textField.addActionListener(mediator());
textField.addFocusListener(mediator());
}
return textField;
}
Figure B.12. The PlaceATub class handles component building, and the PlaceATubMediator class handles events.
The constructor for PlaceATubMediator accepts a PlaceATub object to which ... |
Read now
Unlock full access