I am trying to do the Pong Lab in Dr. Java from A+ Computer Science. I am finished doing everything, however, when I run the game the ball leaves a trail behind. I do not know how to get rid of it and any help would be greatly appreciated. As of right now this is my draw method for the ball. I am drawing the ball blue and the trail should be white as to cover it. The ball being drawn blue is in another method. I just need this to get rid of the ball's trail.
public void moveAndDraw(Graphics window)
{
//draw a white ball at old ball location
draw(window,Color.WHITE);
draw(window,Color.WHITE);//draws over the old ball with whichever color you want
//in case you want to have a trail
setX(getX()+xSpeed);
setY(getY()+ySpeed);
//setY
draw(window); //draws the ball at its new location
}