title: Can a superclass store its subclasses in a list statically?
body: <p>I have a super class, SuperClass. I want a JList displaying every subclass of SuperClass. Not how many subclasses of SuperClass were instantiated, but how many subclasses I have actually defined in my program. The point is that it should be easy to add new subclasses without changing code anywhere else.</p>
  
  <p>I'm hoping that my SuperClass can define a static map that would increase for every subclass I define (not instantiate). Now by clicking on the items of the JList the appropriate subclasses should be instantiated.</p>
  
  <p>I will try to show what I want to do:</p>
  
  <pre><code>public abstract class SuperClass {
      protected static ArrayList&lt;?extends SuperClass&gt; subclasses = new ArrayList&lt;&gt;();
  }
  class SubClassOne extends SuperClass {
      static {
          subclasses.add(this)
      }
  }
  </code></pre>
  
  <p>Now I realize there are lots of problems with above code, but I hope it clarifies what I want. I'm entirely clueless how I should proceed with regards to instantiating my subclasses from the JList.</p>
  
  <p>Please specify if I can give any more information that could be of help.</p>