• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

GUI design  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
I just had the craziest dream. This tiny ad was in it.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!