Java Reference
In-Depth Information
MoveTo { x: 170 y: 95},
HLineTo {x: 280},
MoveTo { x: 180 y: 105},
HLineTo {x: 280},
The previous code segment will draw the image shown in the next screenshot:
How it works...
The Path class and its associated element classes provide a small domain-specific language
(DSL) to express complex shapes programatically. Each path element is represented by a class
with name pattern xxxTo . The Path element provides an idiom with which to express a drawing
action. An action can either move an imaginary pointer to a location on the screen, or it draws a
shape that corresponds to a primitive geometrical shape discussed in the recipe Drawing simple
shapes . The Path class serves as a container providing a property called elements where path
elements are added to the scene graph for rendering.
F MoveTo —this path element causes the path context to be set to a coordinate from
which all subsequent drawing actions will be taken
F ArcTo —this path element creates an arc from the last coordinate to the specified x
and y location
F LineTo —this path element draws a line from the last coordinate (specified with
MoveTo ) to an x and y location
F HLineTo —this path element draws an horizontal line from the last specified x
location to the specified location
F VLineTo —this path element draws a vertical line from the last specified y position to
a newly specified y value
See also
F Building a JavaFX application
F Drawing simple shapes
Search WWH ::

Custom Search