title: Why won't my JPanel background color change?
body: <p>I have been trying to make the background of my JPanel in my frame to be black.  I can get my JButtons to show up in the panel, but the background is still not black as I set it.  I am not sure what I am doing wrong.</p>
  
  <p>I have tried setting the background of the frame and all panels to background color black.  I have made sure I have set everything to be visible.  I have also tried setting setOpaque to true, which did nothing so I removed it.</p>
  
  <p>This is my frame class:</p>
  
  <pre><code>public class GUI extends JFrame{
      public static void main(String[] args) {
          GUI frame = new GUI();
      }
  
      GUI(){
          setLayout(new BorderLayout());
          setVisible(true);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          setSize(500,500);
          setTitle("Polygon Maker");
          DrawPane buttonPane = new DrawPane(false);
          add("North", buttonPane);
          DrawPane drawPane = new DrawPane(true);
          add("Center", drawPane);
          }
  }
  </code></pre>
  
  <p>And this is my panel class:</p>
  
  <pre><code>    DrawPane() {
          drawPane = false;
          setLayout(new FlowLayout());
          setBackground(Color.BLACK);
          setVisible(true);
      }
  
      DrawPane(boolean draw) {
          drawPane = draw;
          setLayout(new FlowLayout());
          setBackground(Color.BLACK);
          setVisible(true);
          if (!draw)
              buttonSetup();
          else {
              addMouseListener(new Drawing());
              current = new DrawPoly();
  
          }
  
      }
  </code></pre>
  
  <p>I am expecting to get a blank black frame with 3 buttons on the top, but instead I get a blank white frame with 3 buttons on the top.  I was trying to avoid the problem but now it is getting it the way of me continuing, and I have no idea what is causing the background not to show up.</p>