This document contains the code for a JavaFX application that draws a snowman scene. The code creates various shapes like circles, lines, and rectangles to represent the different parts of a snowman including the base, middle, head, eyes, mouth, buttons, arms, and hat. It also draws a sun and ground. All the shapes are added to Groups and the overall scene is set on a Stage with a blue sky background.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
69 views3 pages
OOP Lab 14 Task PDF
This document contains the code for a JavaFX application that draws a snowman scene. The code creates various shapes like circles, lines, and rectangles to represent the different parts of a snowman including the base, middle, head, eyes, mouth, buttons, arms, and hat. It also draws a sun and ground. All the shapes are added to Groups and the overall scene is set on a Stage with a blue sky background.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
OOP Lab 14 Task
MUHAMMAD AQIB JAVED
18-SE-50 Code: package application; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.*; public class Snowman extends Application{ public void start(Stage primaryStage) { Ellipse base = new Ellipse(80, 210, 80, 60); base.setFill(Color.WHITE);
Ellipse middle = new Ellipse(80, 130, 50, 40);
middle.setFill(Color.WHITE);
Circle head = new Circle(80, 70, 30);
head.setFill(Color.WHITE);
Circle rightEye = new Circle(70, 60, 5);
Circle leftEye = new Circle(90, 60, 5); Line mouth = new Line(70, 80, 90, 80);
Circle topButton = new Circle(80, 120, 6);
topButton.setFill(Color.RED); Circle bottomButton = new Circle(80, 140, 6); bottomButton.setFill(Color.RED);
Line leftArm = new Line(110, 130, 160, 130);
leftArm.setStrokeWidth(3); Line rightArm = new Line(50, 130, 0, 100); rightArm.setStrokeWidth(3); Rectangle stovepipe = new Rectangle(60, 0, 40, 50); Rectangle brim = new Rectangle(50, 45, 60, 5); Group hat = new Group(stovepipe, brim); hat.setTranslateX(10); hat.setRotate(15);
Group snowman = new Group(base, middle, head, leftEye, rightEye,