rjsantiago0001

StanMarsh

Apr 4th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.42 KB | None | 0 0
  1.  
  2. // Ricardo Santiago
  3. // 4/4/16
  4. // CS-112
  5. // HW12
  6. // This program will generate and image of StanMarsh using JavaFX
  7.  
  8. import javafx.application.Application;
  9. import javafx.scene.Group;
  10. import javafx.scene.Scene;
  11. import javafx.scene.paint.Color;
  12. import javafx.scene.shape.Arc;
  13. import javafx.scene.shape.ArcType;
  14. import javafx.scene.shape.Circle;
  15. import javafx.scene.shape.Ellipse;
  16. import javafx.scene.shape.Line;
  17. import javafx.scene.shape.Rectangle;
  18. import javafx.stage.Stage;
  19.  
  20. public class StanMarsh extends Application {
  21.  
  22.     Color red = new Color(.75, .08, .15, 1.0);
  23.     Color blue = new Color(.24, .33, .53, 1.0);
  24.     Color brown = new Color(.61, .36, .31, 1.0);
  25.     Color skin = new Color(.99, .85, .70, 1.0);
  26.  
  27.     public void start(Stage primaryStage) {
  28.  
  29.         Ellipse arm1 = new Ellipse(485, 380, 80, 35);
  30.         arm1.setRotate(70);
  31.         arm1.setStroke(brown);
  32.         arm1.setFill(brown);
  33.         arm1.setStrokeWidth(3);
  34.  
  35.         Ellipse arm2 = new Ellipse(305, 380, 80, 35);
  36.         arm2.setRotate(110);
  37.         arm2.setStroke(brown);
  38.         arm2.setFill(brown);
  39.         arm2.setStrokeWidth(3);
  40.  
  41.         Arc shoe1 = new Arc(345, 530, 75, 40, 45, 90);
  42.         shoe1.setType(ArcType.CHORD);
  43.         shoe1.setStroke(Color.BLACK);
  44.         shoe1.setFill(Color.BLACK);
  45.         shoe1.setStrokeWidth(3);
  46.  
  47.         Arc shoe2 = new Arc(445, 530, 75, 40, 45, 90);
  48.         shoe2.setType(ArcType.CHORD);
  49.         shoe2.setStroke(Color.BLACK);
  50.         shoe2.setFill(Color.BLACK);
  51.         shoe2.setStrokeWidth(3);
  52.  
  53.         Rectangle body = new Rectangle(302, 300, 190, 165);
  54.         body.setFill(brown);
  55.  
  56.         Line jacketLine = new Line(400, 480, 400, 395);
  57.         jacketLine.setStrokeWidth(4);
  58.  
  59.         Line armLine1 = new Line(297, 430, 305, 370);
  60.         armLine1.setStrokeWidth(2);
  61.  
  62.         Line armLine2 = new Line(488, 370, 494, 430);
  63.         armLine2.setStrokeWidth(2);
  64.  
  65.         Circle button1 = new Circle(385, 405, 05, Color.BLACK);
  66.         Circle button2 = new Circle(385, 435, 05, Color.BLACK);
  67.         Circle button3 = new Circle(385, 465, 05, Color.BLACK);
  68.  
  69.         Rectangle pants = new Rectangle(300, 460, 190, 40);
  70.         pants.setFill(blue);
  71.  
  72.         Rectangle edge = new Rectangle(247, 172, 303, 25);
  73.         edge.setFill(red);
  74.  
  75.         Circle head = new Circle(400, 230, 150, skin);
  76.         Circle pupil1 = new Circle(420, 230, 05, Color.BLACK);
  77.         Circle pupil2 = new Circle(380, 230, 05, Color.BLACK);
  78.  
  79.         Ellipse eye1 = new Ellipse(445, 235, 49, 40);
  80.         eye1.setRotate(45);
  81.         eye1.setFill(Color.WHITE);
  82.         Ellipse eye2 = new Ellipse(355, 235, 49, 40);
  83.         eye2.setRotate(135);
  84.         eye2.setFill(Color.WHITE);
  85.  
  86.         Arc mouth = new Arc(400, 340, 30, 15, 45, 90);
  87.         mouth.setType(ArcType.OPEN);
  88.         mouth.setStroke(Color.BLACK);
  89.         mouth.setFill(null);
  90.         mouth.setStrokeWidth(3);
  91.  
  92.         Arc hat = new Arc(400, 83, 140, 100, 180, 180);
  93.         hat.setType(ArcType.ROUND);
  94.         hat.setFill(blue);
  95.         hat.setStrokeWidth(3);
  96.         hat.setRotate(180);
  97.  
  98.         Arc brim = new Arc(400, 188, 150, 15, 25, 130);
  99.         brim.setType(ArcType.OPEN);
  100.         brim.setStroke(red);
  101.         brim.setFill(null);
  102.         brim.setStrokeWidth(25);
  103.  
  104.         Circle glove1 = new Circle(280, 440, 25, red);
  105.         Circle glove2 = new Circle(510, 440, 25, red);
  106.         Circle thumb1 = new Circle(295, 440, 10, red);
  107.         Circle thumb2 = new Circle(495, 440, 10, red);
  108.         thumb1.setStroke(Color.BLACK);
  109.         thumb2.setStroke(Color.BLACK);
  110.  
  111.         Ellipse collar1 = new Ellipse(355, 370, 50, 15);
  112.         collar1.setRotate(135);
  113.         collar1.setFill(red);
  114.         collar1.setRotate(25);
  115.  
  116.         Ellipse collar2 = new Ellipse(445, 370, 50, 15);
  117.         collar2.setRotate(135);
  118.         collar2.setFill(red);
  119.         collar2.setRotate(155);
  120.  
  121.         Arc jacketBottom = new Arc(395, 470, 95, 15, 20, 135);
  122.         jacketBottom.setType(ArcType.OPEN);
  123.         jacketBottom.setStroke(brown);
  124.         jacketBottom.setRotate(180);
  125.         jacketBottom.setFill(null);
  126.         jacketBottom.setStrokeWidth(25);
  127.  
  128.         Group root = new Group();
  129.         root.getChildren().addAll(edge, pants, body, jacketBottom, arm1, arm2, collar1, collar2, head, eye1, eye2,
  130.                 pupil1, pupil2, mouth, hat, brim, jacketLine, button1, button2, button3, shoe1, shoe2, armLine1,
  131.                 armLine2, glove1, glove2, thumb1, thumb2);
  132.  
  133.         for (int i = 0; i < 8; i++) {
  134.             Rectangle r = new Rectangle(365, 70, 70, 8);
  135.             r.setArcWidth(10);
  136.             r.setArcHeight(10);
  137.             r.setRotate(i * 360 / 16);
  138.             r.setStroke(Color.BLACK);
  139.             r.setFill(red);
  140.             root.getChildren().add(r);
  141.         }
  142.  
  143.         Scene scene = new Scene(root, 800, 700);
  144.  
  145.         primaryStage.setResizable(false);
  146.         primaryStage.setTitle("Stan Marsh");
  147.         primaryStage.setScene(scene);
  148.         primaryStage.show();
  149.  
  150.     }
  151.  
  152.     public static void main(String[] args) {
  153.         Application.launch(args);
  154.     }
  155.  
  156. }
Add Comment
Please, Sign In to add comment