How can I change my TopComponent to not be a singleton?
The “New Window Component” wizard in the NetBeans IDE generates a singleton TopComponent. That’s fine for some uses, but often you will want to create multiple instances of your TopComponent. The good news is that you won’t have to write any code — you’ll just have to delete some of the code that was generated for you. In your TopComponent’s .java source file: • Delete the static instance variable, which ought to be declared a few lines above the constructor. • Make constructor public • Delete the getDefault() method (typically somewhere around the middle of the file) • Delete the findInstance() method (which typically follows the getDefault() method) • Delete the writeReplace() method (typically towards the end of the file) • Delete the ResolvableHelper inner class (typically towards the end of the file) • Only singleton TopComponents can have a persistence mode of PERSISTENCE_ALWAYS, so you must locate the getPersistenceType method and change its return value to either TopComponent.