MVC/MVP/MVVM frameworks for Java GUI applications

前端 未结 5 945
我在风中等你
我在风中等你 2020-12-28 11:07

Can anybody recommend a (preferably open-source) framework for decoupling GUI from model in Java desktop applications?

相关标签:
5条回答
  • 2020-12-28 11:25

    I would strongly suggest you to try the ZK framework. I have not found until today such a srtong framework. In my company we have applied new projects within a few weeks using the latest patterns like MVVM. The style of programming is much like developing a classic 'desktop' app.

    PS: I am in no way related to the ZK people. I am just using their framework.

    0 讨论(0)
  • 2020-12-28 11:26

    Java Swing actually makes good use of MVC for just this purpose.

    0 讨论(0)
  • 2020-12-28 11:31

    Biscotti is a great framework

    0 讨论(0)
  • 2020-12-28 11:46

    From your reaction to the suggestion that Swing is an MVC framework for desktop apps, I think that you really need some kind of generator framework that will generate the 'model' and 'view' code from higher level specifications. Examples I'm (more or less) familiar with are Eclipse EMF, GEF and related technologies.

    0 讨论(0)
  • 2020-12-28 11:48

    Fundamentally decoupling a GUI model from your core java code is best done with a databinding library. Which is to say you have your pojo business code, you have the GUI component code, and you don't fancy writing a load of logic to sync them up all the time whilst updating the view and implementing the business logic. So don't. Find a mature databinding framework for the GUI widgets you are using and learn that; have it keep the screen controls in sync with your pojo code.

    JGoodies and beanbindings are good examples of Swing variants of binding onto an OO model. The core bits of JGoodies are opensource. If you go to /articles on the jgoodies site it has articles on pattern and databinding. Whilst each binding framework has different classes the patterns for writing good clean code are portable between GUI frameworks and bindings frameworks.

    If you download the now opensource WindowsBuilderPro tool then it has excellent examples in both Swing and SWT of doing good databindings. The swing jphonebook example uses the beanbindings library. WindowsBuilderPro is a drag and drop GUI builder; you used to have to pay for it as a leading drag and drop GUI builder which works with the leading free GUI libraries. It was bought by google and opensourced so that they could beef up its graphical screen builder support for GWT (the Google web GUI framework).

    That GUI builder tool has both excellent sample code and is an excellent opensource tool now. It does the same example of a phonebook in both Swing and SWT GUI libraries to demo its drag-and-drop GUI builder tool power. So it is a great way to compare and contrast Swing to SWT whilst learning databindings.

    0 讨论(0)
提交回复
热议问题