title: Java GUI programming: Setting the Fore/Background
body: <p>I'm just getting into GUI programming, slowly learning.</p>
  
  <p>However I'm having a problem right of the bat. I can't get the Fore/Background color to change in my window at all.</p>
  
  <p>However when I add a label via JLabel and then use setFore/Back, they change colors just fine. Just not the whole window.</p>
  
  <p>I thought .setForeground and .setBackground are supposed to change the color of the window?</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class MyWindow {
  
      public static void main(String args[])
      {
           Runnable init = new Runnable()
           {
               public void run()
               {
  
                      JFrame myWindow = new JFrame("Hola!");
                      myWindow.setForeground(Color.YELLOW);
                      myWindow.setBackground(Color.YELLOW);
                      myWindow.setSize(400, 300);
  
                      myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                      myWindow.setLayout(null);
  
                      myWindow.setVisible(true);
  
               }
  
           };
           SwingUtilities.invokeLater(init);
      }
  
  
  }
  </code></pre>