Java Swing中的MVC模式? [英] MVC Pattern in Java Swing?
问题描述
基本上,一个Swing组件本身就是控制器,它具有对视图和模型的引用。
视图位于 JComponent.ui
字段,组件并由Look& Feel机制使用以提供Swing组件的不同视觉表示。
有不同的 setModel()
使用不同模型类型的各种子类的方法,例如 TableModel
或 ButtonModel
,可以通过应用程序进行实现夯实Swing UI显示和操作的实际数据。
Please give me an example for MVC pattern used in Java SWING package ?
Basically, a Swing component is itself a controller, which has a reference to a view and a model.
The view is in the JComponent.ui
field that is inherited by all swing components and used by the Look&Feel mechanism to provide different visual representations of Swing components.
There are different setModel()
methods in various subclasses that use different model types such as TableModel
or ButtonModel
, which can be implemented by an application programmer to contain the actual data that the Swing UI displays and manipulates.
这篇关于Java Swing中的MVC模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!