title: Java2d: JPanel set background color not working
body: <p>I have the code shown below:</p>
  
  <pre><code>public VizCanvas(){
      {
          this.setBackground(Color.black);
          this.setSize(400,400);
      }
  }
  </code></pre>
  
  <p>It worked fine and displays the panel in black background. But when I implement the paint method, which does nothing, the color changes to default color i.e gray.</p>
  
  <p>I tried to set graphics.setColor() but it didn't help.</p>