package def;


import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import javax.swing.*;

/**
 * Class Circles 
 * 
 * @author smh
 * @version 1
 */
public class Circles extends JFrame
{
	public Circles(String title) {
		setTitle(title);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(500, 500);
	
		DrawingPanel drawPanel = new DrawingPanel();
		add(drawPanel, BorderLayout.CENTER);
	}

    public static void main(String[] args) {
       	Circles gui = new Circles("Circles");
       	gui.setVisible(true);
    }
}

class DrawingPanel extends JPanel {

	Color[] colors = {Color.BLACK, Color.CYAN, Color.DARK_GRAY, Color.GRAY, Color.GREEN, Color.LIGHT_GRAY,
					  Color.MAGENTA, Color.ORANGE, Color.PINK, Color.RED, Color.WHITE, Color.YELLOW};

	Color circleColor = Color.black;
	
	public void paintComponent (Graphics g) {

	  int height = getHeight();       // Component methods to get size of drawing surface
	  int width = getWidth();	        
	  int diameter = Math.min(height, width) / 10;     // ok, ok, a magic number for # of circles
	  
	        
	  g.setColor(Color.BLUE);
	  g.fillRect(0, 0, width , height);   // make background color blue
	    	  
	  //int ix = (int) (Math.random() * colors.length) ;
	  //g.setColor(colors[ix]);
       
	  for (int x = width-diameter, y= 0; x >=0 && y <=height-diameter; x -= diameter, y += diameter)  // u gotta prob with , ?
	      {
		  int ix = (int) (Math.random() * colors.length) ;
		  g.setColor(colors[ix]);
		  
	      g.fillOval(x, y, diameter, diameter);
	      }  
	}
}
