title: Cannot make a static reference to the non-static method setBackground(Color) from the type Component
body: <p>I am getting this error Cannot make a static reference to the non-static method setBackground(Color) from the type Component with this piece of code;</p>
  
  <pre><code>    public class ColourChoice {
          private static JPanel myContentPane = new JPanel();
          public static void main(String args[]) {
  
              Object[] colourchoice = {"Default", "Orange"};   
              String UserInput = (String) JOptionPane.showInputDialog(null, "Please choose a colour","ColourChoice",JOptionPane.PLAIN_MESSAGE, null,colourchoice, "Default");
               if (UserInput.equals("Orange")) myContentPane.setBackground(Color.ORANGE);
  
              JFrame window = new JFrame();
              window.setVisible(true);
              window.setSize(100, 100);
              JPanel myContentPane = new JPanel();
              window.setContentPane(myContentPane);
  
       }
    }
  </code></pre>
  
  <p>I have a JFrame, inside I have a JPanel  and with the Frame and panel load, the user can choose a colour from a dropdown menu which will appear before the actual window loads but however, when I write the code for the color 'Panel.setBackground(Color.Orange);' it is giving me the above error.</p>