Question

simple question here but can't find any resources to help me.

In an ActionListener I've made I bring up a new window. I've guessed you keep the main window visibility to false. but how do I close the newly opened window and set the visibility of the old window back to true?

here is my main window which brings up the new window.

    JFrame window = new JFrame();
    public void actionPerformed(ActionEvent e) {
         window.setVisible(false);
         Clock clock = new Clock(initialSize);
         while(clock.isVisible()){
             window.setVisible(false);
         }
         window.setVisible(true);                   
     } 
 });

and here is my new windows ActonListener which closes that one and opens old window.

 public void actionPerformed(ActionEvent ea){    
     jframe.setVisible(false);
 }

I'm new to this, so it may be an obvious answer here which I am unaware of. the current code here is a desperate attempt. Thank you.

Was it helpful?

Solution

but how do I close the newly opened window and set the visibility of the old window back to true?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top