HOW SWING IMPLEMENTS MVC.
HOW SWING IMPLEMENTS MVC.
Swing packages each component's view and controller into an object called a user interface (UI) delegate, that is why, while reading the online java tutorial you'll be told that swing's architecture is not really MVC but a model-delegate. Model-delegate communication is indirect, like the MVC conception therefore one UI delegate can be associated with more than one model.
The base class of all UI delegates is in the swing pluggable look and feel architecture, i.e javax.swing.plaf.ComponentUI or in brief, ComponentUI class.
Important methods of the ComponentUI class although this class is not invoked directly are:
a. createUI. This method is a static public method and it returns a ComponentUI while accepting a JComponent as its parameter. The method returns an instance of the UI delegate for the specified component. Each subclass of this class must provide a static createUI method.
b. installUI. This method configures the specified component appropriate for the look and feel. Invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method completely configures the component for the look and feel.
Read up the above method and others in the api. UI delegate and their use in swing components will be discussed in forthcoming discussions.
In swing, there are sets of UI delegates which contains ComponentUI implementation of most swing components, and each of the sets is called a look and feel or a pluggable look and feel (PLAF). From the api, you'll realize that there are four pluggable look and feel packages, basic, metal, multiplexing and synth. Basic is the set from which every component implements
No comments:
Post a Comment