A ball is supposed to bounce forward in a straight line. So far I've come this far, but cant get it to bounce back on the line.

//Test Miniproject Bolltvå
import java.awt.Graphics;
import java.awt.Color;
import java.applet.Applet;

public class Bolltvå extends Applet{
public void init(){
Color rödbrun = new Color(128, 0, 0);
public void paint(Graphics g){
for (int i = 1; i < 50; i++){
for (int j = 0; j < 1000000000; j++){

g.drawOval(10+i, 50-i, 79, 80);
g.fillOval(11+i, 49-i, 80, 80);
g.drawLine(50, 130, 500, 130);


Also, thers some lines going after the ball, cant get them to disappear.
Thanks in advance, fast answers will be greatly appreciated!