Java Reference
In-Depth Information
It's much easier to customize a component using this pattern, since programmers frequently only have to modify
select parts of the component functionality.
Swing implements the MVC pattern very consistently in the API. Model functionality is represented by interfaces,
as is controller behavior. The View elements are managed through a UI class hierarchy, which has its foundation
in the javax.swing.plaf package. The basic view behavior is set out as a series of abstract classes, which can
subsequently be refined to provide a different look and feel.
As an example, consider the JButton , the class which is used to represent a simple push button. It is associated with a
ButtonModel implementor for the model, a ButtonUI for its view, and possibly one or more event handlers for
its controller.
Prototype (see page 28): Like AWT, Swing also has a number of utility classes that can be cloned, and which
therefore implement the Prototype design pattern: AbstractAction , SimpleAttributeSet , HTMLEditorKit ,
DefaultTreeSelectionModel .
Search WWH ::




Custom Search