title: How do I make a erase a Graphics object?
body: <p>In the code below I am trying to make a ball bounce up and down. The problem is that the ball is painting itself over and over and forming a line rather than a ball moving in a line.</p>
  
  <p>I'm thinking that I need to erase the ball after it draws itself. </p>
  
  <pre><code> public void paint(Graphics g) {
              if (bouncing) {
                  g.setColor(Color.blue);
                  g.drawOval(x, y, 10, 10);
                  //erase oval here
              }
          }
  </code></pre>
  
  <p><strong>NOTE:</strong> Method paint is being called over and over</p>