简体   繁体   中英

Assigning a JFrame to another JFrame

I am trying to make the current JFrame become a JFrame that is stored in memory. At the moment I am correctly reading the JFrame from memory and I can get it to display but all the action listeners are not working.

        gui.dispose();
        gui = savedGUI;
        gui.setVisible(true);

This doesn't seem to be properly setting the current GUI (gui) to the saved version (savedGUI). Is there a different method I should be calling on gui rather than setVisible?

Thanks in advance!

当我确保所有ActionListeners都实现了Serializable时,此问题已解决。

I don't really understand what you are doing either. Why do you think you need to refer to the GUI with a single reference variable?

Just do:

savedGui.setVisible( false );

We you want to display the GUI again you do:

savedGui.setVisible( true );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM