Hello everyone ,
I recently started to study GUI and Event Handling through the book Core Java Volume I Fundamentals and more I get, the more I feel lost . I tried to do a simple example of a program that I had already done in VB but I can not even figure out where to start with Swing. The author of the book in fact always takes into account a single frame where it does all the work and this is confusing me because I have always been accustomed to draw multiple frames in VB.
Let's consider a simple example of a program that keeps track of the expenses for a family. When I did it in VB I have designed a main window with buttons to access each section of the program as Checking Account, Expense Management, Research, Statistics. Each button closes the main window and load/show a new window. In almost all windows you can access other windows, for example, from Expense Management you can open New Expenditure window (opened in modal mode) etc. .. Closing Expense Management window will load/show the main window, and so on.
Now to make a program in Java using Swing without a GUI builder what is the best approach? For example, I could make a single JPanel for each section and add it in turn to the main window or I could use multiple JFrame. Another idea would be to have a main window always visible (like MDI form in VB) with a menu bar from you can open other windows for each section of the program (i.e. Window-> Show Checking Account Sectiont /-> Show Expense Management Section /-> Show Research Section....).
I also think it is better for the user to have multiple windows open simultaneously but how to deal with this situation in Java/Swing?
For example, if you imagine a main frame where there are buttons (or menu) to access other sections, how I can avoid opening multiple frames of the same section ( I think the user need at most one frame for each section )? It's a proper way to disable/enable the button (or the menu element) when the corresponding frame is opened/closed?
Of course this is just an example, I don't ask for the code to implement it but just the concept of how to handle the graphics for this kind of project. Thanks for patience and the help.
Thank you so much for your interest about my problem. Those links are very helpful! Just one question: why did you write that multiple main frame is bad usability? What are the main disadvantages in making a program that uses them?
subject: First steps with Swing: multiple window project. Need help!