title: Java how to color a Rectangle
body: <p>I have a simple GUI application in Java. I just create a window with <code>JFrame</code> and put a rectangle in it. </p>
  
  <p>My problem is that I can't color the area of the Rectangle.</p>
  
  <p>I use the method <code>set.Color(Color.BLACK)</code>, but with this method it colors only the edge of the Rectangle.</p>
  
  <pre><code>public void paintComponent (Graphics g) {
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;
      g2.setColor(Color.YELLOW);
      g2.drawRect(10,20,100,150);
    }
  </code></pre>
  
  <p>How can i color the area?</p>