wangmaster

Untitled

Nov 1st, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1.  
  2. import java.awt.*;
  3. import javax.swing.JPanel;
  4. import javax.swing.JFrame;
  5.  
  6. public class Circles extends JPanel
  7. {
  8. public void paintComponent(Graphics g)
  9. {
  10. for( int x = 0; x <= 0; x++)
  11. {
  12. for( int y = 0; y <= 0; y++)
  13. {
  14. g.setColor(Color.GREEN);//Drawing Backgrounds
  15. g.fillRect(0, 0, 100, 100);
  16. for( int i = 0; i <= 5; i++)
  17. {
  18. g.setColor(Color.YELLOW);//Drawing Circle Color Fills
  19. g.fillOval( 0, 0, 100, 100);
  20. }
  21. for( int i = 0; i <= 5; i++)
  22. {
  23. g.setColor(Color.BLACK);//Drawing Concentric Circles
  24. g.drawOval( 10 * i, 10 * i, 20 * (5 - i), 20 * (5 - i));
  25. }
  26. for( int w = 0; w <= 2 * x + 2; w++)//Drawing The Lines
  27. {
  28. for( int h = 0; h <= 2 * y + 2; h++)
  29. {
  30. g.setColor(Color.BLACK);
  31. g.drawLine(0, 50 * h, 100, 50 * h);//Horzontals
  32. g.drawLine(50 * w, 0, 50 * w, 100);//Verticals
  33. }
  34. }
  35. }
  36. }
  37. for( int x = 0; x <= 5; x++)
  38. {
  39. for( int y = 0; y <= 5; y++)
  40. {
  41. g.setColor(Color.GREEN);
  42. g.fillRect(150 + 40 * x, 20 + 40 * y, 40, 40);
  43. for( int i = 0; i <= 5; i++)
  44. {
  45. g.setColor(Color.YELLOW);
  46. g.fillOval( 150 + 40 * x, 20 + 40 * y, 40, 40);
  47. }
  48. for( int i = 0; i <= 5; i++)
  49. {
  50. g.setColor(Color.BLACK);
  51. g.drawOval(150 + 40 * x + 4 * i, 20 + 40 * y + 4 * i, 8 * (5 - i), 8 * (5 - i));
  52. }
  53. for( int w = 0; w <= 2 * x + 2; w++)
  54. {
  55. for( int h = 0; h <= 2 * y + 2; h++)
  56. {
  57. g.setColor(Color.BLACK);
  58. g.drawLine(150, 20 + 20 * h, 390, 20 + 20 * h);
  59. g.drawLine(150 + 20 * w, 20, 150 + 20 * w, 260);
  60. }
  61. }
  62. }
  63. }
  64. for( int x = 0; x <= 4; x++)
  65. {
  66. for( int y = 0; y <= 4; y++)
  67. {
  68. g.setColor(Color.GREEN);
  69. g.fillRect(10 + 24 * x, 120 + 24 * y, 24, 24);
  70. for( int i = 0; i <= 4; i++)
  71. {
  72. g.setColor(Color.YELLOW);
  73. g.fillOval( 10 + 24 * x, 120 + 24 * y, 24, 24);
  74. }
  75. for( int i = 0; i <= 4; i++)
  76. {
  77. g.setColor(Color.BLACK);
  78. g.drawOval(10 + 24 * x + 3 * i, 120 + 24 * y + 3 * i, 6 * (4 - i), 6 * (4 - i));
  79. }
  80. for( int w = 0; w <= 2 * x + 2; w++)
  81. {
  82. for( int h = 0; h <= 2 * y + 2; h++)
  83. {
  84. g.setColor(Color.BLACK);
  85. g.drawLine(10, 120 + 12 * h, 130, 120 + 12 * h);
  86. g.drawLine(10 + 12 * w, 120, 10 + 12 * w, 240);
  87. }
  88. }
  89. }
  90. }
  91. for( int x = 0; x <= 2; x++)
  92. {
  93. for( int y = 0; y <= 2; y++)
  94. {
  95. g.setColor(Color.GREEN);
  96. g.fillRect(130 + 24 * x, 275 + 24 * y, 24, 24);
  97. for( int i = 0; i <= 2; i++)
  98. {
  99. g.setColor(Color.YELLOW);
  100. g.fillOval( 130 + 24 * x, 275 + 24 * y, 24, 24);
  101. }
  102. for( int i = 0; i <= 2; i++)
  103. {
  104. g.setColor(Color.BLACK);
  105. g.drawOval(130 + 24 * x + 4 * i, 275 + 24 * y + 4 * i, 8 * (3 - i), 8 * (3 - i));
  106. }
  107. for( int w = 0; w <= 2 * x + 2; w++)
  108. {
  109. for( int h = 0; h <= 2 * y + 2; h++)
  110. {
  111. g.setColor(Color.BLACK);
  112. g.drawLine(130, 275 + 12 * h, 202, 275 + 12 * h);
  113. g.drawLine(130 + 12 * w, 275, 130 + 12 * w, 347);
  114. }
  115. }
  116. }
  117. }
  118. }
  119. public static void main(String[] args)
  120. {
  121. Circles panel = new Circles();
  122. JFrame application = new JFrame();
  123. application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  124. application.add(panel);
  125. application.setSize(400, 420);
  126. application.setVisible(true);
  127. }
  128. }
Add Comment
Please, Sign In to add comment