rect.setStroke( Color.RED ); rect.setFill( Color.TRANSPARENT );
A Rectangle
is a child of Shape
and inherits these methods (and others.)
There are many choices in class Color
.
The color is part of the state of the Shape
and may be changed after the object has been
constructed.
The job of a JavaFX Application is to build a scene graph, which the graphics system then renders (paints). The scene graph contains the graphics objects that go into the scene. The above program builds the above (not very complicated) scene graph.
The scene graph is a tree data structure. The scene graph is built by the program and, once built, the picture shows what is in it. The scene graph continues to exists after the picture is produced.
(Confusion Alert !) This picture shows the objects in a scene graph that the program builds when it runs. It is not showing inheritance between classes.
The Rectangle
is sometimes called a child of the Group
but this is not talking about inheritance.
The Rectangle
object is the only object in root
.
Could another Rectangle
object be added to the scene graph?