Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

SceneGraphBuilder

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.

Fonts

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.)

Paints/Colors

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.

Geometry

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.

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

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.

  • No labels