title: Java import enumeration
body: <p>Hi I had a program which worked fine in a .jar file.</p>
  
  <p>Basically all the classes were part of the same package called : "eu.floraresearch.lablib.gui.checkboxtree"
  They ALL are located in the SAME "checkboxTree" folder. Each file has a line stating 
      package eu.floraresearch.lablib.gui.checkboxtree;</p>
  
  <p>I need to modify the code and to integrate it in another project.
  So I took all the .java files, copied them in my Eclipse project folder (no package anymore), and got rid of the "package eu.floraresearch.lablib.gui.checkboxtree;" line in each files. Everything is fine except for one file comprising an enumeration.
  Originally the file looked like this:</p>
  
  <pre><code>package eu.floraresearch.lablib.gui.checkboxtree;
  
  public class QuadristateButtonModel extends DefaultButtonModel {
  
      public enum State {
          CHECKED, GREY_CHECKED, GREY_UNCHECKED, UNCHECKED
      }
      ...
  }
  </code></pre>
  
  <p>The problem is, there is another class which originally imported the above class enumeration:</p>
  
  <pre><code>import eu.floraresearch.lablib.gui.checkboxtree.QuadristateButtonModel.State;
  
  public class QuadristateCheckbox extends JCheckBox {
  
      public QuadristateCheckbox() {
          this(null);
      }
  
      public QuadristateCheckbox(String text) {
      this(text, State.UNCHECKED);
      }
      ...
  }
  </code></pre>
  
  <p>First of all I find it weird how enumerations can be imported.. But it worked fine when everything was inside the package.</p>
  
  <p>Since all my .java files are in the same folder now, I just removed the package line.
  However I have this issue with the QuadristateCheckbox class which imports "QuadristateButtonModel.State".</p>
  
  <p>If I change the import line with </p>
  
  <pre><code>import QuadristateButtonModel.State;
  </code></pre>
  
  <p>it states</p>
  
  <pre><code>The import QuadristateButtonModel cannot be resolved
  </code></pre>
  
  <p>I tried various things I found on the internet like </p>
  
  <pre><code>import static QuadristateButtonModel.State.*;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>import QuadristateButtonModel.State.*;
  </code></pre>
  
  <p>but the same error messages occur: </p>
  
  <pre><code>The import QuadristateButtonModel cannot be resolved
  </code></pre>
  
  <p>On top of that, in the above code from QuadristateCheckbox class:</p>
  
  <pre><code>public QuadristateCheckbox(String text) {
      this(text, State.UNCHECKED);
  }
  </code></pre>
  
  <p>an error message </p>
  
  <pre><code>State cannot be resolved to a variable
  </code></pre>
  
  <p>which is understandable given the fact that I fail to import the State enumeration.</p>
  
  <p>What can I do? Please explain to me what is wrong</p>
  
  <p>PS: The code was taken from this site: <a href="http://www.javaworld.com/article/2077762/core-java/swing-based-tree-layouts-with-checkboxtree.html" rel="nofollow">http://www.javaworld.com/article/2077762/core-java/swing-based-tree-layouts-with-checkboxtree.html</a></p>
  
  <p>The authors provide classes to build checkable trees.</p>