Java Reference
In-Depth Information
Here is the same shape using an SVGPath , using a stroke color instead of a fill
(see Figure 5.32).
SVGPath {
translateX: 50
translateY: 50
fill: Color.TRANSPARENT
stroke: Color.RED
content:
"M0,0 L100,0 A25,20 0 0,0 200,0 L300,0 150,100z"
}
Figure 5.32
SVG Path Example
Programmer Tip: Remember when we discussed using a scene fill of either
null or Color.TRANSPARENT ? Let's reexamine this using the preceding shape.
Because the fill is Color.TRANSPARENT , when you click anywhere inside the shape,
the onMouseClicked function will be called if defined for the shape. However, if
you change the fill to null , now when you click inside the shape, there is no mouse
event generated for the shape. You have to click on the outlined stroke to generate
the event. Though both shapes look the same, there is a big difference when pro-
cessing mouse events. Either way is valid; it all depends on what you are trying to
do with mouse events for the shape.
Java Swing Extension
The javafx.ext.swing package contains numerous JavaFX classes that support
Java Swing components. It is important to note that the Swing extension is not
supported on all platforms, so if you use Swing extensions your application may
not run on a platform like JavaFX Mobile or JavaFX TV.
The Swing components supported are listed in Table 5.5.
 
Search WWH ::




Custom Search