Swing編程學習(二)

MVC,我接觸和了解這個名詞是從Web的開發模式的時候開始接觸的。準確的說,MVC不是一種開發模式,而是一種開發架構。MVC起源於SmartTalk中的GUI編程。
 
Controller和Viewer沒什麼太多好說的,至於Model,Swing定義了許多custom models,這些數據模型爲swing 編程提供了許多方便。舉幾個例子。
 
ButtonModel
Used by: All AbstractButton subclasses.
Stores: A boolean representing whether the button is selected (armed) or unselected (disarmed).
 
TreeModel
Used by: JTree.
Stores: Objects that can be displayed in a tree. Implementations must be able to distinguish between branch and leaf objects, and the objects must be organized hierarchically.
 
Document
Used by: All text components.Stores: Content. Normally this is text (character data). More complex implementations support styled text, images, and other forms of content (such as embedded components).
 

UI Delegates

Swing packages each component’s view and controller into an object called a UI delegate.
UI Delegates 主要是把viewer和controller結合起來了。
y1pnein_qeE00rolukWkl_dtNORZcKG3F0ZiXpQKL2dgtW4qhK3IFq7U-0ofSWZYa4s 
Pluggable Look And Feel

7DBDF42EE58F4A79!225:thumbnail

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章