Java repaint not updating
These data models provide a very powerful programming paradigm for Swing programs that need a clean separation between their application data/logic and their GUI.For truly data-centric Swing components, such as JTree and JTable, interaction with the data model is strongly recommended.The UI delegate used in Swing is described in more detail in the Pluggable look-and-feel section of this article, under the subheading " The UI delegate ".) As the diagram illustrates, Swing architecture is loosely based -- but not .Swing's separable model design treats the model part of a component as a separate element, just as the MVC design does.
Models that use this mechanism support the following methods to add and remove Change Listeners: To provide convenience for programs that don't wish to deal with separate model objects, some Swing component classes also provide the ability to register Change Listeners directly on the component (so the component can listen for changes on the model internally and then propagates those events to any listeners registered directly on the component).
Swing's separable model API makes no specific distinctions between GUI state models and application-data models; ho wever, we have clarified this difference here to give developers a better understanding of when and why they might wish to program with the separable models.
Referring again to the table at the beginning of this section, notice that model definitions are shared across compone nts in cases where the data abstraction for each component is similar enough to support a single interface without over-genericizing that interface.
This separation provides programs with the option of plugging in their own model implementations for Swing components.
The following table shows the component-to-model mapping for Swing.