/*
Paulino Rosado
09/24/2012
Draw a bullseye
*/
import javax.swing.JFrame;
import java.awt.*;
public class Bullseye extends JFrame
{
public Bullseye()
{
}
private void drawCircle(Graphics g,int centerX,int centerY,int diameter,Color color)
{
g.setColor(color);
g.fillOval(centerX-diameter/2,centerY-diameter/2,diameter,diameter);
}
public void paint(Graphics g)
{
drawCircle(g, 100, 125, 175, Color.GREEN);
drawCircle(g, 100, 125, 150, Color.BLUE);
drawCircle(g, 100, 125, 125, Color.GREEN);
drawCircle(g, 100, 125, 100, Color.BLUE);
drawCircle(g, 100, 125, 75, Color.GREEN);
drawCircle(g, 100, 125, 50, Color.BLUE);
}
public static void main(String[]args)
{
Bullseye frame = new Bullseye();
frame.setSize(255,255);
frame.setTitle("Bullseye");
frame.setVisible(true);
}
}