Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.36 KB | None | 0 0
  1. public class MakingArt extends JFrame
  2. {
  3. public static void main(String[] args) {
  4.  
  5.  
  6. MakingArt window = new MakingArt();
  7. window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  8. window.setTitle("making art");
  9. window.setSize(1080, 800); // Here it's just making how big the window is going to be
  10. window.setVisible(true);
  11.  
  12. }
  13. public void paint(Graphics g)
  14. {
  15. Scanner console = new Scanner(System.in);
  16. System.out.println("you can choose either a rectangle, square, smiley face or lines");
  17. String theirChoice = console.nextLine();
  18. if (theirChoice.equals("rectangle"))
  19. {
  20. System.out.println("what color do you want your rectangle to be? blue ,red ,yellow ,orange");
  21. String RectangleColor = console.nextLine();
  22. if (RectangleColor.equals("blue"))
  23. {
  24. System.out.println("What do you want your x cordinate to be max can be 1080");
  25. int x = console.nextInt();
  26. console.nextLine();
  27. System.out.println("What do you want your y cordinate to be max be 800");
  28. int y = console.nextInt();
  29. console.nextLine();
  30. g.setFont(new Font("Serif", Font.PLAIN, 30));
  31. g.drawString("Your Shape", x,(y + 10));
  32. g.setColor(Color.blue);
  33. g.drawRect(x, y, 250, 350);
  34. g.fillRect(x, y, 250, 350);
  35. }
  36. else if (RectangleColor.equals("red"))
  37. {
  38. System.out.println("What do you want your x cordinate to be max can be 1080");
  39. int x = console.nextInt();
  40. console.nextLine();
  41. System.out.println("What do you want your y cordinate to be max be 800");
  42. int y = console.nextInt();
  43. console.nextLine();
  44. g.setFont(new Font("Serif", Font.PLAIN, 30));
  45. g.drawString("Your Shape", x,(y + 10));
  46. g.setColor(Color.red);
  47. g.drawRect(x, y, 250, 350);
  48. g.fillRect(x, y, 250, 350);
  49. }
  50. else if (RectangleColor.equals("yellow"))
  51. {
  52. System.out.println("What do youu want your x cordinate to be");
  53. int x = console.nextInt();
  54. console.nextLine();
  55. System.out.println("What do you want your y cordinate to be max be 800");
  56. int y = console.nextInt();
  57. console.nextLine();
  58. g.setFont(new Font("Serif", Font.PLAIN, 30));
  59. g.drawString("Your Shape", x,(y + 10));
  60. g.setColor(Color.yellow);
  61. g.drawRect(x, y, 250, 350);
  62. g.fillRect(x, y, 250, 350);
  63. }
  64. else if (RectangleColor.equals("orange"))
  65. {
  66. System.out.println("What do you want your x cordinate to be max can be 1080");
  67. int x = console.nextInt();
  68. console.nextLine();
  69. System.out.println("What do you want your y cordinate to be max be 800");
  70. int y = console.nextInt();
  71. console.nextLine();
  72. g.setFont(new Font("Serif", Font.PLAIN, 30));
  73. g.drawString("Your Shape", x,(y + 10));
  74. g.setColor(new Color(255,128,0));
  75. g.fillRect(x, y, 250, 350);
  76. g.fillRect(x, y, 250, 350);
  77.  
  78. }
  79.  
  80.  
  81. }//the original if statement don't delete
  82.  
  83. else if(theirChoice.equals("lines"))
  84. {
  85. System.out.println("How many lines do you want");
  86. int lines = console.nextInt();
  87. console.nextLine();
  88. for(int count = 0; count < lines; count++)
  89. {
  90. System.out.println("What do you want your x cordinate to be max can be 1080");
  91. int firstX = console.nextInt();
  92. console.nextLine();
  93. System.out.println("What do you want your y cordinate to be max be 800");
  94. int firstY = console.nextInt();
  95. console.nextLine();
  96. int lineLength = 100;
  97. int secondY = firstY + lineLength;
  98. int thisX = firstX + 30 * count;
  99. g.drawLine(thisX, firstY, thisX, secondY);
  100. // doesn't stop receiving input from user
  101. }
  102. }
  103.  
  104. else if (theirChoice.equals("smiley face"))
  105. {
  106. System.out.println("what color do you want your smiley face to be? blue,red,yellow,orange");
  107. String colorChoice = console.nextLine();
  108. if (colorChoice.equals("yellow"))
  109. {
  110. g.setColor(Color.black);
  111. g.drawOval(500, 200, 300, 300);
  112. g.setColor(Color.yellow); // width = 100, height = 40
  113. g.fillOval(500, 200, 300, 300);
  114. g.setColor(Color.black);
  115. g.drawOval(580, 300, 30, 50);
  116. g.setColor(Color.black); // width = 100, height = 40
  117. g.fillOval(580, 300, 30, 50);
  118. g.setColor(Color.black);
  119. g.drawOval(680, 300, 30, 50);
  120. g.setColor(Color.black); // width = 100, height = 40
  121. g.fillOval(680, 300, 30, 50);
  122. g.setColor(Color.black);
  123. g.drawArc(570, 320, 150, 120, 195, 150);
  124. }
  125.  
  126.  
  127.  
  128. else if (colorChoice.equals("blue"))
  129. {
  130. g.setColor(Color.black);
  131. g.drawOval(500, 200, 300, 300);
  132. g.setColor(Color.blue);
  133. g.fillOval(500, 200, 300, 300);
  134. g.setColor(Color.black);
  135. g.drawOval(580, 300, 30, 50);
  136. g.setColor(Color.black);
  137. g.fillOval(580, 300, 30, 50);
  138. g.setColor(Color.black);
  139. g.drawOval(680, 300, 30, 50);
  140. g.setColor(Color.black);
  141. g.fillOval(680, 300, 30, 50);
  142. g.setColor(Color.black);
  143. g.drawArc(570, 320, 150, 120, 195, 150);
  144.  
  145. }
  146. else if (colorChoice.equals("red"))
  147. {
  148. g.setColor(Color.black);
  149. g.drawOval(500, 200, 300, 300);
  150. g.setColor(Color.red);
  151. g.fillOval(500, 200, 300, 300);
  152. g.setColor(Color.black);
  153. g.drawOval(580, 300, 30, 50);
  154. g.setColor(Color.black);
  155. g.fillOval(580, 300, 30, 50);
  156. g.setColor(Color.black);
  157. g.drawOval(680, 300, 30, 50);
  158. g.setColor(Color.black);
  159. g.fillOval(680, 300, 30, 50);
  160. g.setColor(Color.black);
  161. g.drawArc(570, 320, 150, 120, 195, 150);
  162.  
  163. }
  164.  
  165. else if (colorChoice.equals("orange"))
  166. {
  167. g.setColor(Color.black);
  168. g.drawOval(500, 200, 300, 300);
  169. g.setColor(new Color(255,128,0)); // width = 100, height = 40
  170. g.fillOval(500, 200, 300, 300);
  171. g.setColor(Color.black);
  172. g.drawOval(580, 300, 30, 50);
  173. g.setColor(Color.black); // width = 100, height = 40
  174. g.fillOval(580, 300, 30, 50);
  175. g.setColor(Color.black);
  176. g.drawOval(680, 300, 30, 50);
  177. g.setColor(Color.black); // width = 100, height = 40
  178. g.fillOval(680, 300, 30, 50);
  179. g.setColor(Color.black);
  180. g.drawArc(570, 320, 150, 120, 195, 150);
  181. }
  182. }
  183.  
  184.  
  185. else if (theirChoice.equals("square"))
  186. {
  187. System.out.println("what color do you want your square to be? blue,red,yellow,orange");
  188. String RectangleColor = console.nextLine();
  189. if (RectangleColor.equals("blue"))
  190. { System.out.println("What do you want your x cordinate to be max can be 1080");
  191. int x = console.nextInt();
  192. console.nextLine();
  193. System.out.println("What do you want your y cordinate to be max be 800");
  194. int y = console.nextInt();
  195. console.nextLine();
  196. g.setFont(new Font("Serif", Font.PLAIN, 30));
  197. g.drawString("Your Shape", x,(y + 10));
  198. g.setColor(Color.blue);
  199. g.drawRect(x, 200, 200, 200);
  200. g.fillRect(y, 200, 200, 200);
  201. }
  202. else if (RectangleColor.equals("red"))
  203. {
  204. System.out.println("What do you want your x cordinate to be max can be 1080");
  205. int x = console.nextInt();
  206. console.nextLine();
  207. System.out.println("What do you want your y cordinate to be max be 800");
  208. int y = console.nextInt();
  209. console.nextLine();
  210. g.setFont(new Font("Serif", Font.PLAIN, 30));
  211. g.drawString("Your Shape", x,(y + 10));
  212. g.setColor(Color.red);
  213. g.drawRect(x, 200, 250, 200);
  214. g.fillRect(y, 200, 250, 200);
  215. }
  216. else if (RectangleColor.equals("yellow"))
  217. {
  218. System.out.println("What do you want your x cordinate to be max can be 1080");
  219. int x = console.nextInt();
  220. console.nextLine();
  221. System.out.println("What do you want your y cordinate to be max be 800");
  222. int y = console.nextInt();
  223. console.nextLine();
  224. g.setFont(new Font("Serif", Font.PLAIN, 30));
  225. g.drawString("Your Shape", x,(y + 10));
  226. g.setColor(Color.yellow);
  227. g.drawRect(x, y, 250, 200);
  228. g.fillRect(x, y, 250, 200);
  229. }
  230. else if (RectangleColor.equals("orange"))
  231. {
  232. System.out.println("What do you want your x cordinate to be max can be 1080");
  233. int x = console.nextInt();
  234. console.nextLine();
  235. System.out.println("What do you want your y cordinate to be max be 800");
  236. int y = console.nextInt();
  237. console.nextLine();
  238. g.setFont(new Font("Serif", Font.PLAIN, 30));
  239. g.drawString("Your Shape", x,(y + 10));
  240. g.setColor(new Color(255,128,0));
  241. g.drawRect(x, y, 250, 200);
  242. g.fillRect(x, y, 250, 200);
  243. }
  244. console.close();
  245. }
  246. }
  247. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement