Group node contains an ObservableList of children that
are rendered in order whenever this node is rendered.
A Group will take on the collective bounds of its children and is
not directly resizable.
Any transform, effect, or state applied to a Group will be applied
to all children of that group. Such transforms and effects will NOT be included
in this Group's layout bounds, however if transforms and effects are set
directly on children of this Group, those will be included in this Group's layout bounds.
By default, a Group will "auto-size" its managed resizable
children to their preferred sizes during the layout pass to ensure that Regions
and Controls are sized properly as their state changes. If an application
needs to disable this auto-sizing behavior, then it should set
autoSizeChildren to false and understand that if the preferred size of
the children change, they will not automatically resize (so buyer beware!).
Group Example:
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import java.lang.Math;
Group g = new Group();
for (int i = 0; i < 5; i++) {
Rectangle r = new Rectangle();
r.setY(i * 20);
r.setWidth(100);
r.setHeight(10);
r.setFill(Color.RED);
g.getChildren().add(r);
}
| Modifier and Type | Field and Description |
|---|---|
| private BooleanProperty | autoSizeChildren
Controls whether or not this |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | Group(Collection<Node>
children of the group children)Constructs a group consisting of the given children. |
| Modifier and Type | Method and Description |
|---|---|
| public final BooleanProperty | |
| private Bounds | |
| public ObservableList | Returns: the list of children of thisGroup.Overrides javafx. Gets the list of children of this |
| public final boolean | |
| protected void | layoutChildren()
Overrides javafx. Group implements layoutChildren such that each child is resized to its preferred size, if the child is resizable. |
| public double | minHeight(double
the width that should be used if minimum height depends on it width)Overrides javafx. Returns the node's minimum height for use in layout calculations. |
| public double | minWidth(double
the height that should be used if minimum width depends on it height)Overrides javafx. Returns the node's minimum width for use in layout calculations. |
| public double | Returns: The layout bounds heightThis parameter is ignored by Group width)Overrides javafx. Group defines the preferred height as simply being the height of its layout bounds, which in turn is simply the union of the layout bounds of all of its children. |
| public double | Returns: The layout bounds widthThis parameter is ignored by Group height)Overrides javafx. Group defines the preferred width as simply being the width of its layout bounds, which in turn is simply the union of the layout bounds of all of its children. |
| public final void |
| autoSizeChildren | back to summary |
|---|---|
| private BooleanProperty autoSizeChildren Controls whether or not this
| |
| Group | back to summary |
|---|---|
| public Group() Constructs a group. | |
| Group | back to summary |
|---|---|
| public Group(Node... children) Constructs a group consisting of children.
| |
| Group | back to summary |
|---|---|
| public Group(Collection<Node> children) Constructs a group consisting of the given children.
| |
| autoSizeChildrenProperty | back to summary |
|---|---|
| public final BooleanProperty autoSizeChildrenProperty() | |
| doComputeLayoutBounds | back to summary |
|---|---|
| private Bounds doComputeLayoutBounds() | |
| getChildren | back to summary |
|---|---|
| public ObservableList Overrides javafx. Gets the list of children of this
| |
| isAutoSizeChildren | back to summary |
|---|---|
| public final boolean isAutoSizeChildren() | |
| layoutChildren | back to summary |
|---|---|
| protected void layoutChildren() Overrides javafx. Group implements layoutChildren such that each child is resized to its preferred
size, if the child is resizable. Non-resizable children are simply left alone.
If
| |
| minHeight | back to summary |
|---|---|
| public double minHeight(double width) Overrides javafx. Doc from javafx. Returns the node's minimum height for use in layout calculations. If the node is resizable, its parent should not resize its height any smaller than this value. If the node is not resizable, returns its layoutBounds height. Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the minimum height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1. Node subclasses with a horizontal content-bias should honor the width parameter whether -1 or a positive value. All other subclasses may ignore the width parameter (which will likely be -1).
If Node's
| |
| minWidth | back to summary |
|---|---|
| public double minWidth(double height) Overrides javafx. Doc from javafx. Returns the node's minimum width for use in layout calculations. If the node is resizable, its parent should not resize its width any smaller than this value. If the node is not resizable, returns its layoutBounds width. Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the minimum width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1. Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
If Node's
| |
| prefHeight | back to summary |
|---|---|
| public double prefHeight(double width) Overrides javafx. Group defines the preferred height as simply being the height of its layout bounds, which in turn is simply the union of the layout bounds of all of its children. That is, the preferred height is the one that it is at, because a Group cannot be resized. Note as the layout bounds in autosize Group depend on the Group to be already laid-out, this call will do the layout of the Group if necessary.
| |
| prefWidth | back to summary |
|---|---|
| public double prefWidth(double height) Overrides javafx. Group defines the preferred width as simply being the width of its layout bounds, which in turn is simply the union of the layout bounds of all of its children. That is, the preferred width is the one that it is at, because a Group cannot be resized. Note as the layout bounds in autosize Group depend on the Group to be already laid-out, this call will do the layout of the Group if necessary.
| |
| setAutoSizeChildren | back to summary |
|---|---|
| public final void setAutoSizeChildren(boolean value) | |