File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Murach's Java Servlets and JSP this week in the Servlets 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

Swing architecture issues, what would you do?

Vandre Caetano

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:
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

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:
subject: Swing architecture issues, what would you do?
Similar Threads
Need the Introductory Concepts About the Swing
Behind Swings.
How swing follows MVC pattern
Best design for a swing application? MVC or one of its variants?
JList Problem