Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.JPanel;
- import javax.swing.JFrame;
- public class Circles extends JPanel
- {
- public void paintComponent(Graphics g)
- {
- for( int x = 0; x <= 0; x++)
- {
- for( int y = 0; y <= 0; y++)
- {
- g.setColor(Color.GREEN);//Drawing Backgrounds
- g.fillRect(0, 0, 100, 100);
- for( int i = 0; i <= 5; i++)
- {
- g.setColor(Color.YELLOW);//Drawing Circle Color Fills
- g.fillOval( 0, 0, 100, 100);
- }
- for( int i = 0; i <= 5; i++)
- {
- g.setColor(Color.BLACK);//Drawing Concentric Circles
- g.drawOval( 10 * i, 10 * i, 20 * (5 - i), 20 * (5 - i));
- }
- for( int w = 0; w <= 2 * x + 2; w++)//Drawing The Lines
- {
- for( int h = 0; h <= 2 * y + 2; h++)
- {
- g.setColor(Color.BLACK);
- g.drawLine(0, 50 * h, 100, 50 * h);//Horzontals
- g.drawLine(50 * w, 0, 50 * w, 100);//Verticals
- }
- }
- }
- }
- for( int x = 0; x <= 5; x++)
- {
- for( int y = 0; y <= 5; y++)
- {
- g.setColor(Color.GREEN);
- g.fillRect(150 + 40 * x, 20 + 40 * y, 40, 40);
- for( int i = 0; i <= 5; i++)
- {
- g.setColor(Color.YELLOW);
- g.fillOval( 150 + 40 * x, 20 + 40 * y, 40, 40);
- }
- for( int i = 0; i <= 5; i++)
- {
- g.setColor(Color.BLACK);
- g.drawOval(150 + 40 * x + 4 * i, 20 + 40 * y + 4 * i, 8 * (5 - i), 8 * (5 - i));
- }
- for( int w = 0; w <= 2 * x + 2; w++)
- {
- for( int h = 0; h <= 2 * y + 2; h++)
- {
- g.setColor(Color.BLACK);
- g.drawLine(150, 20 + 20 * h, 390, 20 + 20 * h);
- g.drawLine(150 + 20 * w, 20, 150 + 20 * w, 260);
- }
- }
- }
- }
- for( int x = 0; x <= 4; x++)
- {
- for( int y = 0; y <= 4; y++)
- {
- g.setColor(Color.GREEN);
- g.fillRect(10 + 24 * x, 120 + 24 * y, 24, 24);
- for( int i = 0; i <= 4; i++)
- {
- g.setColor(Color.YELLOW);
- g.fillOval( 10 + 24 * x, 120 + 24 * y, 24, 24);
- }
- for( int i = 0; i <= 4; i++)
- {
- g.setColor(Color.BLACK);
- g.drawOval(10 + 24 * x + 3 * i, 120 + 24 * y + 3 * i, 6 * (4 - i), 6 * (4 - i));
- }
- for( int w = 0; w <= 2 * x + 2; w++)
- {
- for( int h = 0; h <= 2 * y + 2; h++)
- {
- g.setColor(Color.BLACK);
- g.drawLine(10, 120 + 12 * h, 130, 120 + 12 * h);
- g.drawLine(10 + 12 * w, 120, 10 + 12 * w, 240);
- }
- }
- }
- }
- for( int x = 0; x <= 2; x++)
- {
- for( int y = 0; y <= 2; y++)
- {
- g.setColor(Color.GREEN);
- g.fillRect(130 + 24 * x, 275 + 24 * y, 24, 24);
- for( int i = 0; i <= 2; i++)
- {
- g.setColor(Color.YELLOW);
- g.fillOval( 130 + 24 * x, 275 + 24 * y, 24, 24);
- }
- for( int i = 0; i <= 2; i++)
- {
- g.setColor(Color.BLACK);
- g.drawOval(130 + 24 * x + 4 * i, 275 + 24 * y + 4 * i, 8 * (3 - i), 8 * (3 - i));
- }
- for( int w = 0; w <= 2 * x + 2; w++)
- {
- for( int h = 0; h <= 2 * y + 2; h++)
- {
- g.setColor(Color.BLACK);
- g.drawLine(130, 275 + 12 * h, 202, 275 + 12 * h);
- g.drawLine(130 + 12 * w, 275, 130 + 12 * w, 347);
- }
- }
- }
- }
- }
- public static void main(String[] args)
- {
- Circles panel = new Circles();
- JFrame application = new JFrame();
- application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- application.add(panel);
- application.setSize(400, 420);
- application.setVisible(true);
- }
- }
Add Comment
Please, Sign In to add comment