import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;



public class Pallinachescende{

public static void main(String[] a){

Finestra f= new Finestra();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.show();

}//fine main

}//fine class


class Finestra extends JFrame {

	public Finestra(){

		setTitle("Pallina");
		setSize(500,500);
		Container c = getContentPane();
		Pannello p = new Pannello();
		c.add(p);

		}//fine costruttore


class Pannello extends JPanel{

double h=30;
double w=30;
double dy=1;
double x=15;
double y=0;
double centroY= h/2;
double sigma=4;

	public Pannello() {

		}//fine costruttore

		public void paint(Graphics g){

			super.paintComponent(g);
			Graphics2D g2 = (Graphics2D) g;
			x+=(Math.random()*sigma-sigma/2);
			Ellipse2D ell=new Ellipse2D.Double(x,y+dy,w,h);
			y++;
			for(int i=0; i<1000000;i++);
			g2.fill(ell);
			repaint();


			}//fine paint

	}//fine pannello class

	}//fine finestra class