In-Lab Assignment

(AI: Francisco Lara-Dammer)

Write a program which gives this output. If you click on the screen, you'll get a circle with diameter 20, and a random color.

It is required to use vectors to store the positions of the circles and the random colors, although there are other ways to solve this problem.

It is a good idea to use a vector and not an array because you don't know how many dots the user is going to use.

A solution will be posted on Tuesday.

In order to get the functionality of the mouse, you can use the following code:


import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class Dots extends java.applet.Applet 
    implements MouseListener{
        
   



    public void mouseClicked (MouseEvent e){
    //Leave it empty 
    } 

    public void mousePressed (MouseEvent e){
    //Leave it empty 
    } 
    
    public void mouseReleased(MouseEvent e){ 
	//Do something here
    } 

    public void mouseEntered (MouseEvent e){ 
    //Leave it empty
    } 

    public void mouseExited  (MouseEvent e){ 
    //Leave it empty
    }     
}