Excuse me, I did originally post this question in the Swing forum but felt it was more appropriate here...
I am having trouble deciding how to go about controlling the objects in my application. I want to have a JDesktopPane which when selecting menu options will spawn internal frames. The internal frames should themselves be able to spawn other internal frames.
Anyway I came up with a partial solution. In my GUI_DesktopPane class I have menu items and then also the following methods:
I then have various classes like GUI_MemberStatus that extends JInternalFrame and implements ActionListener. Now what should I do about those "special" internal frames that need to spawn internal frames in the JDesktopPane as well?
Should I:
a) Make the createFrame method static, and use it from wherever
b) Pass a reference of GUI_DesktopPane into the "special" internal frames constructor. Create the new internal frame within a method of the "special" internal frame. Call the createFrame method using the new internal frame as a parameter.
c) Make the GUI_DesktopPane a singleton. Call getinstance().createFrame from wherever I want.
d) Go away, read a book on design patterns, pass my SCJP exam, get a job in IT and stop trying to be a part-time programmer