Say you have JFrames A, B and C. When you click on a JButton that is on the A JFrame, it opens the B JFrame (instantiates it and sets visible to true) and B is hidden.
Now the same happens on B: it opens C by instantiating and setting its visible property to true and hides itself. So now we have 3 instances of those JFrames on memory but only one visible.
Now comes the problem: when C does its job, it is supposed to close (with dispose) and to bring again the B JFrame. It can't be done again by instantiating it because we already have an instance of B running and C doesn't have any reference to the instance of B.
What can be done to solve this? I was thinking if there's any standard way of managing windows on a multiple window aplication such as this example (a set of steps on a wizard, for instance).
I could think of a WindowManager class implemented with the singleton pattern that was responsible for all the opening and closing of windows, but I'm not sure if there's anything else more common that could be done.
Any suggestions?