I have made a menu by using Java with Swing and when I browse through the menu, I have used this method:
backButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
panela.setVisible(false);
start();
}
});
This buttons go back to the start of the menu when the button is pressed, by setting panela to visibility:false and calling the start method. This works fine, but now I want to open a secoundary window besides the window you're already in. I could imagine something like this: (Setting it to true)
backButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
panela.setVisible(true);
start();
}
});
But it messes it up and doesn't really open a new window but tries to open a Jpanel in the existing window I think.
How can I write a actionlistener to open a new window besides the window that is already open?