I want to have logout functionality in java application, I am using some timers in my application. I want to dispose all the jframes, their contents and stop all timers when i click on logout button. And after pressing logout button the main jframe should disappear and login screen should appear with fresh memory.
I have tried to dispose my jframes and make them visible false and make login screen visible.
All the stuff works well but the previous timers are not stopped and application is using more memory.
In general if you want to start from scratch after logout you can try something like starting new instance of application just before you exit the current instance. In any non trivial program it can get problematic to explicitly cleanup everything yourself. Apart from timers you could have various other kinds of resource leakages.