Java Contaning box Seems to get bigger and Bigger
<p>I am writing a bouncing ball class (I'm just starting to use Java) and it works but it looks like every time the ball hits an edge the containing box gets bigger </p>

<p>Code for the bounce trigger</p>

<pre><code>    int i = 0;
    int j = 0;
    int k = 0;
    double x = 3;
    double y = 3;
    while(i &lt; 200){
        if(j == 0){
            x += 2; 
        } else {
            x -= 2; 
        }
        if(k == 0){
            y += 4;
        } else {
            y -= 4;
        }
        if(thisEye.getX() &gt; 400){
            j = 1;
        } 
        if(thisEye.getX() &lt; 0) {
            j = 0;
        }
        if(thisEye.getY() &gt; 200){
            k = 1;
        } 
        if(thisEye.getY() &lt; 0) {
            k = 0;
        }
        Color someShade = rGen.nextColor();    // var for the color of the eyes
        Color someOtherShade = rGen.nextColor();// var for the color of the pupules
        moveThis(thisEye,x,y,someShade);     // Go over all the shapes with the same X,Y offset - var x,y
        moveThis(thisPupul,x,y,someOtherShade);
        moveThis(thisEye2,x,y,someShade);
        moveThis(thisPupul2,x,y,someOtherShade);
        moveThis(face,x,y,rGen.nextColor());
        moveThis(nose,x,y,rGen.nextColor());
        pause(150.0);   // wait for next cycle to slow down the images
        //i++;  this was to see if it just got farther off with each loop, it dose.
    }
}

private void moveThis(GOval subject, double x, double y, Color newShade){
    subject.setFillColor(newShade);
    subject.move(x, y);
}
</code></pre>

<p>the 'face' will bounce off the right spot once then each time it bounces it gets farther and farther off the screen tell is so far of the it only is on screen for a short time then off the other side tell it comes back on screen for a bit.</p>

<p>I marked it as home work but I'm a html/php coder in the day and am just using the iTunesU Stanford videos at night.
but I'm trying to learn so pointers would be great.</p>
