Reputation: 2047
I am converting an older MDI (Multiple Document Interface in Windows-speak, I don't know what it is called in Java) to Multiple SDI (Single Document interface). It's really "one top window with a menu, owning multiple separate JFrames, each containing their own logic and display". I also plan to have Open/Save workspace. MVC is used as the general architecture.
I have started, and the main idea is to create a bunch of JFrame-derived windows which I keep track of in a Window menu. Models and Controllers of course, but its the View/JFrame that is the main problem. I have already lost myself in a myriad of Action handlers and Window Listeners....
Then it hit me, "this can't be the first time someone writes this". A quick search on Google and SO lead me nowhere. But surely there must exist a framework which does this already? (Preferably in a Model-View-Controller design)
When all I want is to create Models and Controllers, and then implement only the thing that is special for each window/JFrame. The rest (Window management, workspace etc) should be preety standard.
I guess I'm looking for something similar to the App-Wizards/Code-generators in DevStudio.
Does such a framework exist, or am I bound to make one myself?
Upvotes: 0
Views: 1090
Reputation: 751
I know this question is old, just leting here my findings since i had this similar question a while ago.
There is really not such framework/utility out-of-the box, swing really only provides UI controls and components, you have to code youself data binging and validation, also its up to you to handle MDI ( using JInterfalFrames) or SDI (Using a single JFrame and a bunch of jpanels).
As you mentioned, swing does not makes implementing MVC easily, due to all code that may end up inside the *Listeners and *Adapters.
You can make a POC to try out varios swing data-binding frameworks like JGoodies or Project Mogwai, disclamer: haven't used neither.
Optionally if the project allows it, you could try alternative UI frameworks for java like Apache Pivot or JavaFX wich does a better job at separating ui from behaivor.
Sorry for my bad english.
Upvotes: 2