import java.awt.*; public class Spots extends java.applet.Applet { final int MAXSPOTS = 10; int xspots[] = new int[MAXSPOTS]; int yspots[] = new int[MAXSPOTS]; int currspots = 0; Label label1 = new Label(); public void init() { setBackground(Color.white); } public boolean mouseDown(Event evt, int x, int y) { if (currspots < MAXSPOTS) { addspot(x,y); return true; } else { label1.setVisible(true); return false; } } void addspot(int x, int y) { xspots[currspots] = x; yspots[currspots] = y; currspots ++; repaint(); } public void paint(Graphics g) { g.setColor(Color.blue); for (int i = 0; i< currspots; i++) { g.fillOval(xspots[i] -10,yspots[i] -10, 20, 20); } } public Spots() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { label1.setBackground(Color.white); label1.setFont(new java.awt.Font("Dialog", 1, 16)); label1.setForeground(Color.red); label1.setText("SOLO 10 PUNTOS"); label1.setVisible(false); label1.setBounds(new Rectangle(62, 104, 149, 15)); this.setLayout(null); this.add(label1, null); } }