title: non-static method getContentPane() cannot be referenced from a static context error in java swing
body: <p>non-static method getContentPane() cannot be referenced from a static context error in java swing </p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.Component;
  import java.awt.event.*;
  
  public class Studentlogin extends JFrame{
     public static void main(String[] args) {
  
      Container c = getContentPane();
  
      setTitle(" Staff Signin ");
      setSize( 400 , 300);
      setLayout(new FlowLayout());    
      setVisible(true);
      setLayout(null);
  
      JLabel tun = new JLabel("UserName");
      tun.setBounds(10,10,140,25);
      c.add(sun);
  
      JTextField tuname = new JTextField(10);
      tuname.setToolTipText("Enter your StaffId ");
      tuname.setBounds(145,10,200,25);
      c.add(tuname);
  
      JLabel tpw = new JLabel("PassWord");
      tpw.setBounds(10,50,140,25);
      c.add(tpw); 
  
      JPasswordField tpword = new JPasswordField(10);
      tpword.setEchoChar('*');
      tpword.setBounds(145,50,200,25);
      c.add(tpword);
  }
  }
  </code></pre>
  
  <p>while compiling this i get this type of error can anyone find me what is wrong with this code because i can execute this same type format of code in actionlistrener segment</p>
  
  <pre><code>Studentlogin.java:9: error: non-static method getContentPane() cannot be referen
  ced from a static context
                  Container c = getContentPane();
                                ^
  Studentlogin.java:11: error: non-static method setTitle(String) cannot be refere
  nced from a static context
                  setTitle(" Staff Signin ");
                  ^
  Studentlogin.java:12: error: non-static method setSize(int,int) cannot be refere
  nced from a static context
                  setSize( 400 , 300);
                  ^
  </code></pre>