GUI Architecture and Design in Java (Swing)

I have spent the last several hours scouring the internet looking for examples and ideas on how to write a medium sized GUI in java. I know a little about swing but that is all. I don't know of any other way to develop a GUI in Java besides swing. If you know of a different way that would be good too. I also want to hand-write the GUI myself to allow for easier integration with our game and future refactoring.

We have written the entire business logic to a Tic Tac Toe game that has several features. The gui needs to have several windows which can be navigated using simple buttons on the interface. A very crude and water-downed version of what I am looking to do can be seen below:

The Heart of my question is this:

How do I architect the GUI using Swing and what general design is used?

and some follow-up questions: Is there a class for every window? Do I just use setvisible to make my windows appear and disappear after the buttons are pressed?

`re there any examples you all know of (github repos would be excellent! happy forking!) that could show me a good gui architecture/design?

Answers


I think you can create multiple JPanels (or their extensions) place them in one container with CardLayout and switch cards when necessary.


Also consider the Model–View–Controller pattern, discussed here.


Need Your Help

IE8 Block elements with width/height not detecting a mouseover until text inside is hovered

html css internet-explorer internet-explorer-8

In IE8 block elements with a set width/height will display properly but mouse events and linking only work for text inside of that element. A mouseover will not be detected until the text inside of...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.