title: java repaint blocks out jbutton
body: <p>Inside my paintComponent() method, I have a drawRect() that paints the background of a jpanel. But because the jbutton is drawn on the screen before the paintComponent() method gets called, the jbutton is blocked out by the drawRect. Does anyone know how to fix this? My guess is to add the jbutton before repaint gets called, but I don't know how to do that?</p>
  
  <p>Some code:</p>
  
  <pre><code>public Frame(){
    add(new JButton());
  }
  
  public void paintComponent(Graphics g){
    super.paintComponent(g);
    g.drawRect(0,0,screenwidth,screenheight); //paints the background with a color 
                                              //but blocks out the jbutton.
  }
  </code></pre>