Java Reference
In-Depth Information
Mediator (Chapter 10)
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;
}