Java SE MVC implementation with Swing

后端 未结 2 1902
情歌与酒
情歌与酒 2020-12-18 14:22

I\'ve implemented MVC pattern for Java SE with Swing using PropertyChageSupport and PropertyChageListener. The diagram for implemented MVC is as fo

2条回答
  •  鱼传尺愫
    2020-12-18 14:47

    Your diagram suggests a model–view–presenter (MVP) pattern, which is compatible with Swing application design. In this context, Action is a convenient way to encapsulate application functionality for export from you model. As concrete examples:

    • DefaultEditorKit and StyledEditorKit export useful Action types that operate on the Document model common to text components. As shown in this example, such actions update the Document, which indirectly updates the corresponding view component.

    • The ControlPanel in the example cited here exposes a number of Action instances that operate directly on an implicit model of List and List.

提交回复
热议问题