File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Singleton in SWING Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Singleton in SWING" Watch "Singleton in SWING" New topic

Singleton in SWING

Gavin Bong
Ranch Hand

Joined: Apr 25, 2003
Posts: 56
I have a singleton that generates monotonically increasing ids for
my SWING app. Although the singleton will be unloaded when the SWING app terminates; I suspect that the app will be running for like 8 hours a day. Is there a way to replace the singleton ?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Replace it why?

[Jess in Action][AskingGoodQuestions]
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Your singleton will of course be unloaded once your application is terminated and exit JVM. Are you saying you want the id to keep increment even after close and restart of your application?
In that case, I guess you can serialized your counter class.
I agree. Here's the link:
subject: Singleton in SWING
It's not a secret anymore!