title: Problems with setting JPanel's colour
body: <p>Here's my canvas class extending <code>JPanel</code>:</p>
  
  <pre><code>package start;
  
  import java.awt.Color;
  import java.awt.Graphics;
  import javax.swing.JPanel;
  
  public class Board extends JPanel
  {
      private static final long serialVersionUID = 1L;
  
      public Board() {}
  
      public void paintComponent(Graphics g) 
      {
          int width = getWidth();
          int height = getHeight();
          this.setBackground(Color.green);
  
          g.setColor(Color.black);
          g.drawOval(0, 0, width, height);
      }
  }
  </code></pre>
  
  <p>Here's the method where I'm calling it:</p>
  
  <pre><code>private static void createAndShowGUI() 
  {
  
  JFrame frame = new JFrame("Hello");
  frame.setPreferredSize(new Dimension(700, 700));
  
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
  Board b = new Board();
  frame.getContentPane().add(b);
  
  frame.pack();
  frame.setVisible(true);
  }
  </code></pre>
  
  <p>But this shows the oval on the default colour. I also tried without the <code>this.</code>, and then tried setting the colour of <code>b</code>, and setting the colour inside the constructor, but none of these worked. What's wrong?</p>
  
  <p>EDIT: Sorry for not making thing clear, my goal was to display a thin black oval on a green background.</p>