aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes GUI design 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 » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "GUI design " Watch "GUI design " New topic
Author

GUI design

Maksym Odintsov
Greenhorn

Joined: Jan 22, 2009
Posts: 11
Hi guys. I implemented my GUI in such way that I have the same JFrame for the server, standalone client, and network client. So depending on the mode of the program this JFrame chooses to show some fields and labels or not to show them. I read something simalar in the Andrews book, he used common panel for all modes.
But I'm using not the panel, but a frame and this means that inside the ActionListener of the start button I use case operator to determine the mode of the program and then start server or open the main window etc.
So How do you think is it a bad design and it's better to implement 3 separate frames(though they will use a lot of similar JTextFields and labels ... ) for server, client and network client with 3 separate ActionListeners
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
What I had was an abstract config view (which contained all common code) with 3 subclasses, and used the State design pattern for instantiating one of these subclasses.
Both my config and client views were directly inheriting from JFrame.


SCJP 1.4 100%
SCJD 99.5%
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
Hello Maksym:

What I used was only one frame and three panels, but on this three panels I had common code so I used the Template Method Pattern to put all the common code in an abstrac class and I just set the code that changed in subclasses. I used Panels because I believe they are easier to change than frames.

By the way I do not mean changing code or maintenance, I tried to say change from one panel to another (like from the configuration panel to the main panel that contains the search criteria and all that stuff).


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
www.ulisespulido.com
 
 
subject: GUI design