CH - 14 JavaFX - II

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 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