JavaFX Graphics: Shapes and Color - Lab Report #8, Study Guides, Projects, Research of Mathematics

Object-oriented programming (OOP) refers to a type of computer programming (software design) in which programmers define the data type of a data structure, and also the types of operations (functions) that can be applied to the data structure.

Typology: Study Guides, Projects, Research

2019/2020

Uploaded on 01/11/2020

samia-khan-2
samia-khan-2 🇵🇸

4.8

(4)

11 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
LAB REPORT: #8
SUBJECT Graphics in
JavaFX
SUBMITTED BY: SAMIA
REG. NO: 17JZBCS0022
DEPARTMENT: CS&IT
pf3
pf4
pf5

Partial preview of the text

Download JavaFX Graphics: Shapes and Color - Lab Report #8 and more Study Guides, Projects, Research Mathematics in PDF only on Docsity!

LAB REPORT:

SUBJECT Graphics in

JavaFX

SUBMITTED BY: SAMIA

REG. NO: 17JZBCS

DEPARTMENT: CS&IT

TITLE: Shapes and

color

Exercise 1:

  • In BlueJ, create a new project called Lab
  • Create a class in that project called MyShapes
  • Since this will be a JavaFX applicaDon, add the extends Applica6on clause to the class header.
  • Create the standard JavaFX start method, passing in a Stage object called primaryStage
  • Import the needed classes.
  • Make sure the program compiles, though it won't do anything yet.

SOLUTION:

Exercise 2:

  • Create an empty Group object to serve as the root of the scene.
  • Create a Scene object, specifying the root group and making the scene 500 pixels wide and 300 pixels tall. Give the scene a background color of light blue.
  • Set the Dtle on the primary stage (the main applicaDon window) to "My JavaFX Shapes".
  • Add the scene to the stage.
  • Show the stage.
  • Run the program to see the window. Remember to choose the Run JavaFX Program opDon – you don't run the start method directly.

width of 20, and a pink fill.

SOLUTION:

Exercise 6:

  • Create a general snowman shape using two ellipses and a circle as shown below.
  • Use a fill of white for each, and don't set the stroke.

SOLUTION:

Exercise 7:

  • "Sign" your artwork by puZng your name (using a Text object) in the bo[om right corner of the scene.

SOLUTION:

OUTPUT: