0% found this document useful (0 votes)
60 views

CH - 14 JavaFX - II

The document discusses shapes and graphics in JavaFX. It describes the coordinate system in JavaFX and provides examples of drawing different shapes like lines, rectangles, circles, arcs, polygons, and polylines. It explains the properties and methods for drawing these shapes and includes code snippets and diagrams to illustrate arc and polygon shapes. The document concludes with a case study on developing a class to display a clock using JavaFX graphics.

Uploaded by

rahulthephoenix
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

CH - 14 JavaFX - II

The document discusses shapes and graphics in JavaFX. It describes the coordinate system in JavaFX and provides examples of drawing different shapes like lines, rectangles, circles, arcs, polygons, and polylines. It explains the properties and methods for drawing these shapes and includes code snippets and diagrams to illustrate arc and polygon shapes. The document concludes with a case study on developing a class to display a clock using JavaFX graphics.

Uploaded by

rahulthephoenix
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Rahul Talreja

Rahul Talreja
3

Multiple Stages

Rahul Talreja
4

Rahul Talreja
5

Rahul Talreja
6

Drawing a Circle
Rahul Talreja
7

Co-ordinate System

x
Y Axis
(0, 0) X Axis

y
(x, y)
(0, 0) X Axis
Java Conventional
Coordinate Coordinate
System System
Y Axis

Rahul Talreja
8

Shapes
JavaFX provides many shape classes for drawing texts, lines, circles,
rectangles, ellipses, arcs, polygons, and polylines.

Rahul Talreja
9

Text

Rahul Talreja
10

Text Example

Rahul Talreja
11

Line

Rahul Talreja
12

Rectangle

Rahul Talreja
13

Rectangle Example

Rahul Talreja
14

Circle

Rahul Talreja
15

Ellipse

radiusX radiusY
(centerX, centerY)

Rahul Talreja
16

Arc

Rahul Talreja
17

Arc Examples
radiusY length

startAngle

0 degree

radiusX
(centerX, centerY)

–30° –50°

–20° 20°

(a) Negative starting angle –30° and (b) Negative starting angle –50°
negative spanning angle –20° and positive spanning angle 20°

Rahul Talreja
18

Polygon and Polyline

Rahul Talreja
19

Polygon

The getter and setter methods for property values and a getter for property
javafx.scene.shape.Polygon itself are provided in the class, but omitted in the UML diagram for brevity.
+Polygon() Creates an empty polygon.
+Polygon(double... points) Creates a polygon with the given points.
+getPoints(): Returns a list of double values as x- and y-coordinates of the points.
ObservableList<Double>

Rahul Talreja
20

Case Study: Clock


This case study develops a class that displays a clock on a
pane.

Rahul Talreja
21

Thanks!
Any questions?
You can find me at:
Wechat
Dingtalk

Rahul Talreja

You might also like