Advertisement
mcnealk

Project1

Oct 19th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.87 KB | None | 0 0
  1. **
  2. * Write a description of class Project1 here.
  3. *
  4. * @author Kailey McNeal
  5. * @version 10-19-14
  6. * Project 1 p230
  7. */
  8. import java.awt.*;
  9. import java.applet.*;
  10. public class Project1 extends Applet
  11. {
  12. public void paint(Graphics g)
  13. {
  14. g.setColor(Color.cyan);
  15. g.fillRect(0,0,400,400);
  16. drawTile(g,0,0,1,100,5);
  17. drawTile(g,10,120,5,24,4);
  18. drawTile(g,150,20,6,40,5);
  19. drawTile(g,130,275,3,36,3);
  20. // drawTopl(g);
  21. // drawBotl(g);
  22. // drawTopr(g);
  23. // drawBotr(g);
  24. }
  25. public static void drawTile(Graphics g, int x, int y, int numoftiles, int sizeoftile, int numcircle)
  26. {
  27. // for(int i=0; i<numoftiles; i++)
  28. // {
  29. // for(int j=0; j<numoftiles; j++)
  30. // {
  31. // g.setColor(Color.green);
  32. // g.fillRect(x,y,sizeoftile,sizeoftile);
  33. // g.setColor(Color.black);
  34. // g.drawRect(x,y,sizeoftile,sizeoftile);
  35. // circle(g,x,y,sizeoftile,numoftiles,numcircle);
  36. // printCircle(g,x,y,sizeoftile, numcircle,sizeoftile);
  37. // }
  38. for(int i=0; i<numoftiles; i++)
  39. {
  40.  
  41.  
  42. for(int k=0; k<numoftiles; k++)
  43. {
  44. g.setColor(Color.green);
  45. g.fillRect(x,y,sizeoftile,sizeoftile);
  46. g.setColor(Color.black);
  47. g.drawRect(x,y,sizeoftile,sizeoftile);
  48. circle(g,x,y,sizeoftile,numoftiles,numcircle);
  49. printCircle(g,x,y,sizeoftile, numcircle,sizeoftile);
  50. x=x+sizeoftile;
  51. }
  52. x=x-sizeoftile*numoftiles;
  53. y=y+sizeoftile;
  54. }
  55. }
  56.  
  57. public static void circle(Graphics g, int x, int y, int sizeoftile, int numofrows, int numcircle)
  58. {
  59. for (int i=0; i<=numofrows; i++)
  60. {
  61. printCircle(g,x,y,sizeoftile,numcircle,sizeoftile);
  62.  
  63. }
  64. }
  65.  
  66. public static void printCircle(Graphics g, int x, int y, int circlesize, int numcircle, int sizeoftile)
  67. {
  68.  
  69. for(int i=0; i<numcircle; i++)
  70. {
  71. g.setColor(Color.yellow);
  72. g.fillOval(x+i*circlesize/numcircle/2,y+i*circlesize/numcircle/2,circlesize-i*circlesize/numcircle,circlesize-i*circlesize/numcircle);
  73. }
  74. for(int i=0; i<numcircle; i++)
  75. {
  76. g.setColor(Color.black);
  77. g.drawOval(x+i*circlesize/numcircle/2,y+i*circlesize/numcircle/2,circlesize-i*circlesize/numcircle,circlesize-i*circlesize/numcircle);
  78. }
  79. g.setColor(Color.black);
  80. g.drawLine(x+sizeoftile/2,y,x+sizeoftile/2,y+sizeoftile);
  81. g.drawLine(x,y+sizeoftile/2,x+sizeoftile,y+sizeoftile/2);
  82. // public static void drawTopl(Graphics g)
  83. // {
  84. //
  85. //
  86. //
  87. //
  88. //
  89. // // g.setColor(Color.green);
  90. // // g.fillRect(0,0,100,100);
  91. // // g.setColor(Color.black);
  92. // // g.drawRect(0,0,100,100);
  93. // //
  94. // // g.setColor(Color.yellow);
  95. // // g.fillOval(0,0,100,100);
  96. // // g.setColor(Color.black);
  97. // // g.drawOval(0,0,100,100);
  98. // //
  99. // // g.setColor(Color.yellow);
  100. // // g.fillOval(10,10,80,80);
  101. // // g.setColor(Color.black);
  102. // // g.drawOval(10,10,80,80);
  103. // //
  104. // // g.setColor(Color.yellow);
  105. // // g.fillOval(20,20,60,60);
  106. // // g.setColor(Color.black);
  107. // // g.drawOval(20,20,60,60);
  108. // //
  109. // // g.setColor(Color.yellow);
  110. // // g.fillOval(30,30,40,40);
  111. // // g.setColor(Color.black);
  112. // // g.drawOval(30,30,40,40);
  113. // //
  114. // // g.setColor(Color.yellow);
  115. // // g.fillOval(40,40,20,20);
  116. // // g.setColor(Color.black);
  117. // // g.drawOval(40,40,20,20);
  118. // //
  119. // // g.drawLine(50,0,50,100);
  120. // // g.drawLine(0,50,100,50);
  121. // }
  122. // public static void drawBotl(Graphics g)
  123. // {
  124. // for (int j=0; j<=4;j++)
  125. // {
  126. // int x=(10+24*j);
  127. // int y=120;
  128. // int size=24;
  129. // g.setColor(Color.green);
  130. // g.fillRect(x,y,size,size);
  131. // g.setColor(Color.black);
  132. // g.drawRect(x,y,size,size);
  133. //
  134. // for(int i=0; i<=4; i++)
  135. // {
  136. //
  137. // x=x-i*3;
  138. // y=y-i*3;
  139. //
  140. //
  141. // //1 circle
  142. // g.setColor(Color.yellow);
  143. // g.fillOval(x,y,size,size);
  144. // g.setColor(Color.black);
  145. // g.drawOval(x,y,size,size);
  146. // g.drawLine(x+size/2,y,x+size/2, y+size);
  147. // }
  148. // // for (int i=0; i<=3;i++)
  149. // // {
  150. // //
  151. // //
  152. // // g.setColor(Color.green);
  153. // // g.fillRect(34,120,24,24);
  154. // // g.setColor(Color.black);
  155. // // g.drawRect(34,120,24,24);
  156. // // //1 circle
  157. // // g.setColor(Color.yellow);
  158. // // g.fillOval(34,120,24,24);
  159. // // g.setColor(Color.black);
  160. // // g.drawOval(34,120,24,24);
  161. // //
  162. // // g.setColor(Color.yellow);
  163. // // g.fillOval(31,117,18,18);
  164. // // g.setColor(Color.black);
  165. // // g.drawOval(31,117,18,18);
  166. // //
  167. // // g.setColor(Color.yellow);
  168. // // g.fillOval(28,114,12,12);
  169. // // g.setColor(Color.black);
  170. // // g.drawOval(28,114,12,12);
  171. // //
  172. // // g.setColor(Color.yellow);
  173. // // g.fillOval(25,111,6,6);
  174. // // g.setColor(Color.black);
  175. // // g.drawOval(25,111,6,6);
  176. // // g.drawLine(36,0,48,24);
  177. // // g.drawLine(24,12,48,12);
  178. // //
  179. // //
  180. // //
  181. // //
  182. // // g.setColor(Color.green);
  183. // // g.fillRect(58,120,24,24);
  184. // // g.setColor(Color.black);
  185. // // g.drawRect(58,120,24,24);
  186. // // //1 circle
  187. // // g.setColor(Color.yellow);
  188. // // g.fillOval(58,120,24,24);
  189. // // g.setColor(Color.black);
  190. // // g.drawOval(58,120,24,24);
  191. // //
  192. // // g.setColor(Color.yellow);
  193. // // g.fillOval(55,117,18,18);
  194. // // g.setColor(Color.black);
  195. // // g.drawOval(55,117,18,18);
  196. // //
  197. // // g.setColor(Color.yellow);
  198. // // g.fillOval(52,114,12,12);
  199. // // g.setColor(Color.black);
  200. // // g.drawOval(52,114,12,12);
  201. // //
  202. // // g.setColor(Color.yellow);
  203. // // g.fillOval(49,111,6,6);
  204. // // g.setColor(Color.black);
  205. // // g.drawOval(49,111,6,6);
  206. // // g.drawLine(60,0,72,24);
  207. // // g.drawLine(48,12,72,12);
  208. // //
  209. // //
  210. // //
  211. // // g.setColor(Color.green);
  212. // // g.fillRect(82,120,24,24);
  213. // // g.setColor(Color.black);
  214. // // g.drawRect(82,120,24,24);
  215. // // //1 circle
  216. // // g.setColor(Color.yellow);
  217. // // g.fillOval(82,120,24,24);
  218. // // g.setColor(Color.black);
  219. // // g.drawOval(58,120,24,24);
  220. // //
  221. // // g.setColor(Color.yellow);
  222. // // g.fillOval(55,117,18,18);
  223. // // g.setColor(Color.black);
  224. // // g.drawOval(55,117,18,18);
  225. // //
  226. // // g.setColor(Color.yellow);
  227. // // g.fillOval(52,114,12,12);
  228. // // g.setColor(Color.black);
  229. // // g.drawOval(52,114,12,12);
  230. // //
  231. // // g.setColor(Color.yellow);
  232. // // g.fillOval(49,111,6,6);
  233. // // g.setColor(Color.black);
  234. // // g.drawOval(49,111,6,6);
  235. // // g.drawLine(60,0,72,24);
  236. // // g.drawLine(48,12,72,12);
  237. // //
  238. // //
  239. // // }
  240. //
  241. //
  242. // }
  243. // }
  244. }
  245. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement