aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Swing architecture issues, what would you do? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Swing architecture issues, what would you do?" Watch "Swing architecture issues, what would you do?" New topic
Author

Swing architecture issues, what would you do?

Vandre Caetano
Greenhorn

Joined: Dec 19, 2007
Posts: 15
Hi there

The think is: I am trying to make sense of java Swing achitecture.
At first I was daydreaming of a Swing architecture where I would have a Model, with some sort of Data Object and a save method. In my humble head it sounded simple...
So I started reading and found the following article: http://java.sun.com/products/jfc/tsc/articles/architecture/
which talks about Swing separable model architecture using some interfaces like the Document one, and after reading it and trying things on my omw I am far far more lost than when I first started

Consider the following cenario:

1 JPanel with 4 JTextField and a save button

So.. acording to sun, it would need take 4 Documents (one for each field) and 1 ButtonModel(for the button) with some small among of the logic in each of then and.. hum.. In the end it seens... well... overcomplicated so I decided to try something else which got me right back and the lost status.

How would you do a swing architecture where in the end you would have a Model with some sort of Data Object and a save method?
Would you not use Suns Documente/Other models interface? would you override all JComponets with some personal implementation? Is there any page you advice me to read?


Thanks in Advance
Oliver Watkins
Greenhorn

Joined: Jul 21, 2008
Posts: 13
It only needs to be as complicated as it needs to be. What would you have a Document for each textfield? You should only worry about the complexities of the Swing architecture when you get to tables and trees.

Just use setText and getText on the text fields, and add an action listener to the button. Done.

Olly [url removed]


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swing architecture issues, what would you do?