nel metodo mousePressed ho inserito
codice:
public void mousePressed(MouseEvent e)
{
Point p = new Point(e.getX(),e.getY());
caricatore.addFirst(p);
while(caricatore.size() < MAX_COLPI)
caricatore.addFirst(p);
}
mentre nel metodo draw:
codice:
public synchronized void draw(Graphics2D g)
{
int count = caricatore.size();
Window window = screen.getFullScreenWindow();
g.setColor(window.getBackground());
g.fillRect(0,0,screen.getWidth(),screen.getHeight());
g.setColor(window.getForeground());
for(int i=0; i<count; i++)
{
Point p = (Point)caricatore.get(i);
g.fillOval(p.x, p.y, 12,12);
}
}
ho costruito il seguente codice ma in questo modo costruisce un numero infinito di cerchi.