class shootApplet extends JApplet { public void init() { setContentPane(new game() );
}
class game extends JPanel implements MouseListener { private int width,height; int score=0; int x1,x2,x3,y1,y2,y3; int shot=0; int b_no[]=new int[3]; int x[]=new int[3]; int y[]=new int[3]; private Ball ball; game() { setBackground(Color.yellow);
public void paintComponent(Graphics g) { super.paintComponent(g); // Fill panel with background color, green. if (ball==null) { // The first time that paintComponent is called, it assigns // values to the instance variables. width = getWidth(); height = getHeight(); ball=new Ball(); }