Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *
- * Name: Lu Liu
- * Date: 4/1/2016
- * Course Number: CSC-112
- * Course Name: Intermediate Topics in Java Programming
- * Email: lliu0001@student.stcc.edu
- *
- * Assignment: HW # 12
- * Programe Description:
- * Stan Marsh Pane Class
- * South Park's Stan Marsh Rendering Graphics Assignment
- *
- */
- import javafx.application.Application;
- import javafx.scene.Group;
- import javafx.scene.Scene;
- import javafx.scene.image.Image;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.BorderPane;
- import javafx.scene.layout.HBox;
- import javafx.scene.layout.Pane;
- import javafx.scene.layout.StackPane;
- import javafx.scene.paint.Color;
- import javafx.stage.Stage;
- import javafx.scene.shape.Arc;
- import javafx.scene.shape.ArcType;
- import javafx.scene.shape.Circle;
- import javafx.scene.shape.Ellipse;
- import javafx.scene.shape.Line;
- import javafx.scene.shape.Rectangle;
- public class StanMarchPane extends Pane {
- public StanMarchPane() {
- draw();
- }
- public void draw() {
- Pane pane = new Pane();
- // boby
- Rectangle r1 = new Rectangle(100, 260, 160, 130);
- r1.setFill(Color.rgb(159, 91, 84));
- // arms
- Arc arc1 = new Arc(180, 340, 120, 120, 0 + 15, 150);
- arc1.setType(ArcType.CHORD);
- arc1.setFill(Color.rgb(159, 91, 84));
- // clothes line
- Line line = new Line(180, 305, 180, 380);
- line.setStroke(Color.BLACK);
- line.setStrokeWidth(3);
- line.setRotate(5);
- // buttons and hands
- Circle c1 = new Circle(170, 320, 3, Color.BLACK);
- Circle c2 = new Circle(169, 338, 3, Color.BLACK);
- Circle c3 = new Circle(168, 355, 3, Color.BLACK);
- Circle c4 = new Circle(80, 325, 25, Color.RED);
- Circle c5 = new Circle(100, 315, 10, Color.RED);
- c5.setStroke(Color.BLACK);
- Circle c6 = new Circle(280, 325, 25, Color.RED);
- Circle c7 = new Circle(260, 315, 10, Color.RED);
- c7.setStroke(Color.BLACK);
- // legs
- Rectangle r2 = new Rectangle(110, 390, 140, 20);
- r2.setFill(Color.rgb(78, 99, 157));
- // foot 1
- Arc arc2 = new Arc(145, 480, 80, 80, 0 + 57, 65);
- arc2.setFill(Color.BLACK);
- arc2.setType(ArcType.CHORD);
- arc2.setStroke(Color.BLACK);
- // foot 2
- Arc arc3 = new Arc(215, 480, 80, 80, 0 + 57, 65);
- arc3.setFill(Color.BLACK);
- arc3.setType(ArcType.CHORD);
- arc3.setStroke(Color.BLACK);
- // face
- Circle face = new Circle(180, 180, 120);
- face.setFill(Color.rgb(252, 216, 182));
- face.setStrokeWidth(1);
- // eye
- Ellipse e1 = new Ellipse(220, 190, 40, 30);
- Ellipse e2 = new Ellipse(150, 190, 40, 30);
- Circle e3 = new Circle(160, 190, 5);
- Circle e4 = new Circle(210, 190, 5);
- e1.setFill(Color.WHITE);
- e2.setFill(Color.WHITE);
- e3.setFill(Color.BLACK);
- e4.setFill(Color.BLACK);
- e2.setRotate(135);
- e1.setRotate(45);
- // mouth
- Arc arc4 = new Arc(188, 330, 80, 80, 75, 35);
- arc4.setFill(Color.BLACK);
- arc4.setType(ArcType.OPEN);
- //hat
- Arc arc5 = new Arc(180, 180, 120, 120, 0 + 15, 150);
- arc5.setType(ArcType.CHORD);
- arc5.setFill(Color.rgb(76, 97, 155));
- //hatband
- Rectangle r3 = new Rectangle(60, 120, 240, 30);
- r3.setFill(Color.RED);
- getChildren().clear();
- getChildren().addAll(r1, arc1, line, c1, c2, c3, c4, c5, c6, c7, r2, arc2, arc3, face, e1, e2, e3, e4, arc4,
- arc5, r3);
- // hat top
- for (int i = 0; i < 10; i++) {
- Rectangle r4 = new Rectangle(150, 60, 60, 3);
- r4.setRotate(i * 360 / 14);
- r4.setFill(Color.RED);
- r4.setStroke(Color.BLACK);
- getChildren().add(r4);
- }
- }
- }
Add Comment
Please, Sign In to add comment