Organizing a java GUI

smithseo

New Member
I'm fairly new at GUIs, and I'd like to understand how to properly structure my program.I'm looking to create a GUI for a MVC model(all control methods are already implemented). Say I need to have 3 separate windows, with certain buttons closing one window and opening another.I was thinking of having 3 classes, one for each window. Each window would be a JFrame. Is that reasonable? Then, we need to put in the action listeners. Where would those go? I'm thinking there should be one other class, with the main method. That class could also have all the action listeners, since that's the class that also creates the control and is capable of calling control's methods. Is this a good way to go about it? Whatever your recommendation is, could you provide an idea of how this would look in terms of code? I know how to put together components in one frame, and add a listener within that frame so that a button performs some action. But I'm not sure how this would look with multiple windows. Any small example would do. Thanks.
 
Back
Top