So, I have a program which has a swing GUI. (Java - duh!) I really, really don't think the way I'm structuring my classes now is good, so I am reorganizing from the ground up to follow best practices.
UI - The big daddy. It's intended usage is to first create the containing JFrame, call for the construction of all of the subcomponents of the UI, then add them in a border layout to the JFrame (would it be wise to structure this as a singleton? After all, I don't want two UI's?)
RightPanel, LeftPanel, BottomPanel, TopPanel, CenterPanel. Different panels of UI subcomponents. I have a class for each of these panels.
Menu- The menubar. A seperate class just to keep menu duties seperated from the rest of the UI code.
I'm not quite sure how to structure these, within relation to each other.
A few possible options I have thought about, (just what I've come up with, there is probably a better way to do all of this):
Make all classes an inner class of UI. I don't like this option for obvious code bloat reasons.
Make each class independent of UI. Possibly even make each class a singleton, since I'd only ever need one UI along with all of it's components.
The millions of better ideas that haven't even crossed my mind.
What is a good way to do this? I'm by no means an expert on design patterns yet. I'm still trying to get an exceptionally solid grasp on OOP concenpts.
(Unnecessary additional concerns):
Additionally, I obviously need a way for my program to interact with the UI, updating displayed information on multiple components from one event, and for buttons within different subcomponents to dispatch to a handler, sending data along on it's way and possibly even modifying other UI stuff. If you could devise an efficient way to structure this I'd love you even more