Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MakingArt extends JFrame
- {
- public static void main(String[] args) {
- MakingArt window = new MakingArt();
- window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- window.setTitle("making art");
- window.setSize(1080, 800); // Here it's just making how big the window is going to be
- window.setVisible(true);
- }
- public void paint(Graphics g)
- {
- Scanner console = new Scanner(System.in);
- System.out.println("you can choose either a rectangle, square, smiley face or lines");
- String theirChoice = console.nextLine();
- if (theirChoice.equals("rectangle"))
- {
- System.out.println("what color do you want your rectangle to be? blue ,red ,yellow ,orange");
- String RectangleColor = console.nextLine();
- if (RectangleColor.equals("blue"))
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(Color.blue);
- g.drawRect(x, y, 250, 350);
- g.fillRect(x, y, 250, 350);
- }
- else if (RectangleColor.equals("red"))
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(Color.red);
- g.drawRect(x, y, 250, 350);
- g.fillRect(x, y, 250, 350);
- }
- else if (RectangleColor.equals("yellow"))
- {
- System.out.println("What do youu want your x cordinate to be");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(Color.yellow);
- g.drawRect(x, y, 250, 350);
- g.fillRect(x, y, 250, 350);
- }
- else if (RectangleColor.equals("orange"))
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(new Color(255,128,0));
- g.fillRect(x, y, 250, 350);
- g.fillRect(x, y, 250, 350);
- }
- }//the original if statement don't delete
- else if(theirChoice.equals("lines"))
- {
- System.out.println("How many lines do you want");
- int lines = console.nextInt();
- console.nextLine();
- for(int count = 0; count < lines; count++)
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int firstX = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int firstY = console.nextInt();
- console.nextLine();
- int lineLength = 100;
- int secondY = firstY + lineLength;
- int thisX = firstX + 30 * count;
- g.drawLine(thisX, firstY, thisX, secondY);
- // doesn't stop receiving input from user
- }
- }
- else if (theirChoice.equals("smiley face"))
- {
- System.out.println("what color do you want your smiley face to be? blue,red,yellow,orange");
- String colorChoice = console.nextLine();
- if (colorChoice.equals("yellow"))
- {
- g.setColor(Color.black);
- g.drawOval(500, 200, 300, 300);
- g.setColor(Color.yellow); // width = 100, height = 40
- g.fillOval(500, 200, 300, 300);
- g.setColor(Color.black);
- g.drawOval(580, 300, 30, 50);
- g.setColor(Color.black); // width = 100, height = 40
- g.fillOval(580, 300, 30, 50);
- g.setColor(Color.black);
- g.drawOval(680, 300, 30, 50);
- g.setColor(Color.black); // width = 100, height = 40
- g.fillOval(680, 300, 30, 50);
- g.setColor(Color.black);
- g.drawArc(570, 320, 150, 120, 195, 150);
- }
- else if (colorChoice.equals("blue"))
- {
- g.setColor(Color.black);
- g.drawOval(500, 200, 300, 300);
- g.setColor(Color.blue);
- g.fillOval(500, 200, 300, 300);
- g.setColor(Color.black);
- g.drawOval(580, 300, 30, 50);
- g.setColor(Color.black);
- g.fillOval(580, 300, 30, 50);
- g.setColor(Color.black);
- g.drawOval(680, 300, 30, 50);
- g.setColor(Color.black);
- g.fillOval(680, 300, 30, 50);
- g.setColor(Color.black);
- g.drawArc(570, 320, 150, 120, 195, 150);
- }
- else if (colorChoice.equals("red"))
- {
- g.setColor(Color.black);
- g.drawOval(500, 200, 300, 300);
- g.setColor(Color.red);
- g.fillOval(500, 200, 300, 300);
- g.setColor(Color.black);
- g.drawOval(580, 300, 30, 50);
- g.setColor(Color.black);
- g.fillOval(580, 300, 30, 50);
- g.setColor(Color.black);
- g.drawOval(680, 300, 30, 50);
- g.setColor(Color.black);
- g.fillOval(680, 300, 30, 50);
- g.setColor(Color.black);
- g.drawArc(570, 320, 150, 120, 195, 150);
- }
- else if (colorChoice.equals("orange"))
- {
- g.setColor(Color.black);
- g.drawOval(500, 200, 300, 300);
- g.setColor(new Color(255,128,0)); // width = 100, height = 40
- g.fillOval(500, 200, 300, 300);
- g.setColor(Color.black);
- g.drawOval(580, 300, 30, 50);
- g.setColor(Color.black); // width = 100, height = 40
- g.fillOval(580, 300, 30, 50);
- g.setColor(Color.black);
- g.drawOval(680, 300, 30, 50);
- g.setColor(Color.black); // width = 100, height = 40
- g.fillOval(680, 300, 30, 50);
- g.setColor(Color.black);
- g.drawArc(570, 320, 150, 120, 195, 150);
- }
- }
- else if (theirChoice.equals("square"))
- {
- System.out.println("what color do you want your square to be? blue,red,yellow,orange");
- String RectangleColor = console.nextLine();
- if (RectangleColor.equals("blue"))
- { System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(Color.blue);
- g.drawRect(x, 200, 200, 200);
- g.fillRect(y, 200, 200, 200);
- }
- else if (RectangleColor.equals("red"))
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(Color.red);
- g.drawRect(x, 200, 250, 200);
- g.fillRect(y, 200, 250, 200);
- }
- else if (RectangleColor.equals("yellow"))
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(Color.yellow);
- g.drawRect(x, y, 250, 200);
- g.fillRect(x, y, 250, 200);
- }
- else if (RectangleColor.equals("orange"))
- {
- System.out.println("What do you want your x cordinate to be max can be 1080");
- int x = console.nextInt();
- console.nextLine();
- System.out.println("What do you want your y cordinate to be max be 800");
- int y = console.nextInt();
- console.nextLine();
- g.setFont(new Font("Serif", Font.PLAIN, 30));
- g.drawString("Your Shape", x,(y + 10));
- g.setColor(new Color(255,128,0));
- g.drawRect(x, y, 250, 200);
- g.fillRect(x, y, 250, 200);
- }
- console.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement