I have three frames, let's call them Frame Welcome, Frame Main, Frame Sub. They're all in separate classes.
Frame Welcome has a button that makes Frame Main visible when clicked.
Frame Main has a button that makes Sub pop up when clicked (sort of a dialog box yeah but it has graphical design so I figured out to just put it in a separate frame, though I'm considering JPanel but I'm not sure how to do that: how to make it pop up when it's in a JPanel, possibly setVisible but I havent tried that yet so I might try it later), but there is also a button in Frame Sub which when clicked, should make Frame Main and Frame Sub invisible and display Frame Welcome only instead.
At the moment, I have a code for making Sub disappear and make Welcome appear, but I can't figure out how to make Main invisible too.
public void actionPerformed (ActionEvent e)
{
if (e.getSource() == btn)
{
FrameWelcome fw = new FrameWelcome();
setVisible(false);
fw.setVisible(true);
}
}
This makes the Frame Sub invisible and the Frame Welcome visible, but how will I make Frame Main invisible too (Sub is SORT OF inside Main, because it's displayed when a button is clicked in Main)? This isn't exactly my code but I'm not sure which parts to post so yeah