package inner;
import javax.swing.*;
import java.awt.event.*;
public class BallGame extends JFrame {
	public static void main(String[] args){
		JFrame f = new BallGame();
		f.setDefaultCloseOperation(EXIT_ON_CLOSE);
		f.pack();
		f.setVisible(true);
	}
	public BallGame ()
	{
		getContentPane().add(new BallField());
	}
}

class BallField extends JComponent implements MouseListener{
	// position and radius of a ball
	private int x = 50, y = 50, r = 10;
	public BallField (){
		// set preferred size of the ball field
		setPreferredSize(new java.awt.Dimension(300,300));
	}
	public void paint (java.awt.Graphics g) {


		g.setColor(java.awt.Color.red);
		g.fillOval(x-r, y-r, 2*r, 2*r);
	} // in order to repaint the ball field call the repaint method

	public void mouseMoved(Java.awt.event e)
	{

	}


}