import java.awt.Color; import java.util.*; import uwcse.io.*; import uwcse.graphics.*; import javax.swing.*; /** * A class to create and manipulate graphics elements stored in an ArrayList * (the graphics elements are squares) */ public class GraphicsElements { /** Maximum number of disks in a pile of disks */ public static final int MAXIMUM_NUMBER_OF_SQUARES = 100; /** Width of the window (from ViewWindow) */ public static final int WIDTH = ViewWindow.WINDOW_WIDTH; /** Height of the window (from ViewWindow) */ public static final int HEIGHT = ViewWindow.WINDOW_HEIGHT; /** * Generate a list of squares randomly located in the window. Use filled * squares. The color of each square is either yellow, blue or red.
* Store the squares in an ArrayList and return that ArrayList
* The number of squares is given by the user (use a dialog box). If that * number is less than or equal to 0 or greater than * MAXIMUM_NUMBER_OF_SQUARES, display an error message (use * JOptionPane.showMessageDialog)and ask for it again. */ public ArrayList getRandomSquares() { // Get the number of squares from the user // Create the list of squares } /** * Erase the square at location (x,y) if any. */ public void eraseElementAt(int x, int y, ArrayList listOfSquares) { } /** * Display the number of red squares, blue squares and yellow squares */ public void displayStatistics(ArrayList listOfSquares) { } }