开发者

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 differe开发者_C百科nt method I should be calling on gui rather than setVisible?

Thanks in advance!


The problem was solved when I made sure all the ActionListeners implemented 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 );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜