SceneGraphBuilder Add comment to Wiki View in Wiki Edit Wiki page Printable Version


The SceneGraphBuilder is the main helper class for doing Groovy Markup for JavaFX 2.0. 

The following sections describe some of the generalized behavior supported in the SceneGraphBuilder on all nodes and attributes defined in the MarkUP.


All font attributes may of course be set with a JavaFX Font object (javafx.scene.text.Font). In addition, fonts may be defined using the JavaFX CSS styles for "-fx-font" or "-fx-font-size". If a font size string is presented, then the default Font will be used with that size. (see CSS Reference Guide.)


All color and paint attributes may be set with one of the JavaFX Paint or Color objects (javafx.scene.paint.LinearGradientjavafx.scene.paint.RadialGradient and javafx.scene.paint.Color). In addition, colors may be set using the pseudo color variables, such as red, green, blue, etc. Colors may also be defined as a web string such as "#333", "cyan", etc. Colors may also be defined using the JavaFX CSS styles for colors, linear, and radial gradients. (see JavaFX CSS Reference Guide) Also see SceneGraphBuilder - paint for more details.

Enumerated Values

All Java Enumerations may be set using their string equivalents. For example, if an attribute field is of type javafx.geometry.Pos, then the value may be set with one of the string values, "center", "bottom_left", etc.

There are some special cases where Object instances are used rather than enumerations. For example the javafx.scene.Cursor class contains numerous singleton instances for the various cursors that may be set on the scene. Also, there are special pseudo variables for the Orientation enumeration, horizontal and vertical.


The Geometry objects in the javafx.geometry package, Point2D, Point3D, Dimension2D, Rectangle2D, and BoundingBox,  may be set using numbered lists. For the 2D classes, 2 numbers must be provided, and for the 3D classes, 3 numbers must be provided. BoundingBox may be either 2D, requiring 4 values, or 3D, requiring 6 values. A Rectangle2D may also take and empty list or the "EMPTY" string as shown in the previous section on Insets.


The javafx.geometry.Insets class may be instantiated by using the javafx class, or by using a Groovy number list. If a number list is used, it may contain, one, two, or four numbers. If one number is presented then all sides of the Insets will be set to that value. If two numbers are presented then the first number will be used to set the top and bottom side of the Inset, and the second number will be used to set the left and right side of the Inset. If four numbers are present in the list, the numbers will be assigned to the the top, right, bottom and left in order. An empty list or the String "empty" will map to the Insets.EMPTY object.


ToggleGroups are identified with an unique string across the SceneGraphBuilder context. To tie a toggle type button to a specific ToggleGroup, use the special attribute toggleGroup on the Toggle type button. Buttons with the same ToggleGroup names will be assigned the same ToggleGroup instance.



Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified