title: Cannot solve import javax.swing.* error in Eclipse
body: <p>When I create Java application builder and Main class in same package, and I imported javax swing as <code>import java.swing.*</code> then I have an error in main class.</p>
  
  <p><strong>Main class</strong></p>
  
  <pre><code>import javax.swing.*;
  
  public class SMS {
  
      public static void main(String[] args){
          MainFrame mf = new MainFrame(); //ok
          mf.setVisible(true);  //error
          mf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  //error
      }
  
  }
  </code></pre>
  
  <p>I had an error last two lines as <code>The method setVisible(boolean) is undefined for the type</code> and another one <code>The method setDefaultCloseOperation(int) is undefined for the type</code>.</p>
  
  <p>And I already set JRE path as,</p>
  
  <ul>
  <li><p>Installed (and selected) JDK in Eclipse : <code>Window -&gt; Preferences -&gt; Java -&gt; Installed JREs</code></p></li>
  <li><p>Selected JDK : <code>Project -&gt; Properties -&gt; Java Build Path -&gt; Libraries</code></p></li>
  <li><p>Included "Java Builder" : <code>Project -&gt; Properties -&gt; Builders</code></p></li>
  </ul>
  
  <p>But I had an above error. Can I help me to fix this error to run my code...?</p>