![]() |
How to return to an instance?
I am having a problem. If I have a JFrame open in a class and it performing and processing, when I close it, it still performs the work, which is good because this is what I want it to do. How do I actually return to that instance of the running program, if I go back to the main menu and click the button to load it up again, it makes a brand new instance. I need to return to the already running one.
Code for the back button MainMenu m = new MainMenu(); m.setVisible(true); dispose(); Code for loading up JFRAME Again from Main Menu SandHopper sHopper = new SandHopper(); dispose(); sHopper.setVisible(true); If someone can help me out here it would be great. Thank you. |
Re: How to return to an instance?
You'll want a slightly different design where you keep a SandHopper object and instead of creating a new one each time you set it visible again. You can wrap this into a static method similar to this:
:
class SandHopper { |
| All times are GMT -5. The time now is 4:21 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC