double i = 0; int x = 200; int y = 200; public void paint(Graphics g){ g.drawLine(x,y,200,300); Double xx = new Double(200 + Math.sin(1/20 * i) * 200); x = xx.intValue(); Double yy = new Double(200 - Math.rint(Math.cos(1/20 * i) * 200)); y = yy.intValue(); i += 1; }