The Mediator Pattern thus allows programs to organize the relationships and interactions between controls, frames, nonvisual objects and events in a controller class specifically tailored for an application. There are often dependancies between these controls on a dialog. For example, a disabled button gets enabled when text in an edit box changes. Selecting an entry in a list-box may change the contents of a text box. Once text appears in this field, other menus may get enabled.
Different dialogs have different dependancies between the controls that they display.
The problem can be solved by encapsulating the collective behavior in a separate mediator object. This mediator object would be responsible for controlling and coordinating the interactions of a group of control objects. This mediator object thus serves as an intermediary and prevents the objects from referring to each other explicitly. MFC uses the mediator pattern in the implementation of the CDialog class. Similarly, Java's AWT uses the mediator pattern in the implementation of the java.awt.Dialog class.