This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a small program that opens up JFrame1. Clicking on a button creates a new JFrame (JFrame2) and hides JFrame1. I have a button on JFrame2 which says "BACK". I want this button to "kill" JFrame2 and take me back to JFrame1. How do I do that? Unload JFrame2 or whatever it might be called?
I think a CardLayout is what you want. Instead of two different frames you have one frame. Inside this frame you have a JPanel with the contents of both frames. The first button shows the next card, the second button shows the previous card.
No, thats not what Im looking for. I would like to have a couple of buttons on my JFrame2.
Agree that CardLayout could work best, but also you may have a significant misconception about what a JDialog is and can do. Do you know for instance that JDialogs can hold GUIs that are every bit as complex as JFrames, "couple of buttons" and all?