35 import javafx.css.StyleableBooleanProperty;
36 import javafx.css.StyleableDoubleProperty;
37 import javafx.css.StyleableObjectProperty;
38 import javafx.css.StyleableProperty;
39 import javafx.geometry.Insets;
40 import javafx.geometry.Orientation;
41 import javafx.geometry.Pos;
42 import javafx.geometry.VPos;
43 import javafx.scene.Node;
44 import javafx.css.converter.BooleanConverter;
45 import javafx.css.converter.EnumConverter;
46 import javafx.css.converter.SizeConverter;
47 import javafx.css.Styleable;
48 import javafx.geometry.HPos;
49 import javafx.util.Callback;
50
51
52
53 /**
54 * HBox lays out its children in a single horizontal row.
55 * If the hbox has a border and/or padding set, then the contents will be layed
56 * out within those insets.
57 * <p>
58 * HBox example:
59 * <pre>{@code
60 * HBox hbox = new HBox(8); // spacing = 8
61 * hbox.getChildren().addAll(new Label("Name:), new TextBox());
62 * }</pre>
63 *
64 * HBox will resize children (if resizable) to their preferred widths and uses its
65 * fillHeight property to determine whether to resize their heights to
66 * fill its own height or keep their heights to their preferred (fillHeight defaults to true).
67 * The alignment of the content is controlled by the alignment property,
68 * which defaults to Pos.TOP_LEFT.
69 * <p>
70 * If an hbox is resized larger than its preferred width, by default it will keep
71 * children to their preferred widths, leaving the extra space unused. If an
72 * application wishes to have one or more children be allocated that extra space
73 * it may optionally set an hgrow constraint on the child. See "Optional Layout
74 * Constraints" for details.
75 * <p>
92 * <tr><th scope="row">preferred</th>
93 * <td>left/right insets plus the sum of each child's pref width plus spacing between each child.</td>
94 * <td>top/bottom insets plus the largest of the children's pref heights.</td></tr>
95 * <tr><th scope="row">maximum</th>
96 * <td>Double.MAX_VALUE</td><td>Double.MAX_VALUE</td></tr>
97 * </table>
98 * <p>
99 * An hbox's unbounded maximum width and height are an indication to the parent that
100 * it may be resized beyond its preferred size to fill whatever space is assigned
101 * to it.
102 * <p>
103 * HBox provides properties for setting the size range directly. These
104 * properties default to the sentinel value USE_COMPUTED_SIZE, however the
105 * application may set them to other values as needed:
106 * <pre><code>
107 * <b>hbox.setPrefWidth(400);</b>
108 * </code></pre>
109 * Applications may restore the computed values by setting these properties back
110 * to USE_COMPUTED_SIZE.
111 * <p>
112 * HBox does not clip its content by default, so it is possible that childrens'
113 * bounds may extend outside its own bounds if a child's min size prevents it from
114 * being fit within the hbox.</p>
115 *
116 * <h3>Optional Layout Constraints</h3>
117 *
118 * <p>
119 * An application may set constraints on individual children to customize HBox's layout.
120 * For each constraint, HBox provides a static method for setting it on the child.
121 * </p>
122 *
123 * <table border="1">
124 * <caption>HBox Constraint Table</caption>
125 * <tr><th scope="col">Constraint</th><th scope="col">Type</th><th scope="col">Description</th></tr>
126 * <tr><th scope="row">hgrow</th><td>javafx.scene.layout.Priority</td><td>The horizontal grow priority for the child.</td></tr>
127 * <tr><th scope="row">margin</th><td>javafx.geometry.Insets</td><td>Margin space around the outside of the child.</td></tr>
128 * </table>
129 * <p>
130 * For example, if an hbox needs the TextField to be allocated all extra space:
131 * <pre><code>
132 * HBox hbox = new HBox();
|
35 import javafx.css.StyleableBooleanProperty;
36 import javafx.css.StyleableDoubleProperty;
37 import javafx.css.StyleableObjectProperty;
38 import javafx.css.StyleableProperty;
39 import javafx.geometry.Insets;
40 import javafx.geometry.Orientation;
41 import javafx.geometry.Pos;
42 import javafx.geometry.VPos;
43 import javafx.scene.Node;
44 import javafx.css.converter.BooleanConverter;
45 import javafx.css.converter.EnumConverter;
46 import javafx.css.converter.SizeConverter;
47 import javafx.css.Styleable;
48 import javafx.geometry.HPos;
49 import javafx.util.Callback;
50
51
52
53 /**
54 * HBox lays out its children in a single horizontal row.
55 * If the hbox has a border and/or padding set, then the contents will be laid
56 * out within those insets.
57 * <p>
58 * HBox example:
59 * <pre>{@code
60 * HBox hbox = new HBox(8); // spacing = 8
61 * hbox.getChildren().addAll(new Label("Name:), new TextBox());
62 * }</pre>
63 *
64 * HBox will resize children (if resizable) to their preferred widths and uses its
65 * fillHeight property to determine whether to resize their heights to
66 * fill its own height or keep their heights to their preferred (fillHeight defaults to true).
67 * The alignment of the content is controlled by the alignment property,
68 * which defaults to Pos.TOP_LEFT.
69 * <p>
70 * If an hbox is resized larger than its preferred width, by default it will keep
71 * children to their preferred widths, leaving the extra space unused. If an
72 * application wishes to have one or more children be allocated that extra space
73 * it may optionally set an hgrow constraint on the child. See "Optional Layout
74 * Constraints" for details.
75 * <p>
92 * <tr><th scope="row">preferred</th>
93 * <td>left/right insets plus the sum of each child's pref width plus spacing between each child.</td>
94 * <td>top/bottom insets plus the largest of the children's pref heights.</td></tr>
95 * <tr><th scope="row">maximum</th>
96 * <td>Double.MAX_VALUE</td><td>Double.MAX_VALUE</td></tr>
97 * </table>
98 * <p>
99 * An hbox's unbounded maximum width and height are an indication to the parent that
100 * it may be resized beyond its preferred size to fill whatever space is assigned
101 * to it.
102 * <p>
103 * HBox provides properties for setting the size range directly. These
104 * properties default to the sentinel value USE_COMPUTED_SIZE, however the
105 * application may set them to other values as needed:
106 * <pre><code>
107 * <b>hbox.setPrefWidth(400);</b>
108 * </code></pre>
109 * Applications may restore the computed values by setting these properties back
110 * to USE_COMPUTED_SIZE.
111 * <p>
112 * HBox does not clip its content by default, so it is possible that children's
113 * bounds may extend outside its own bounds if a child's min size prevents it from
114 * being fit within the hbox.</p>
115 *
116 * <h3>Optional Layout Constraints</h3>
117 *
118 * <p>
119 * An application may set constraints on individual children to customize HBox's layout.
120 * For each constraint, HBox provides a static method for setting it on the child.
121 * </p>
122 *
123 * <table border="1">
124 * <caption>HBox Constraint Table</caption>
125 * <tr><th scope="col">Constraint</th><th scope="col">Type</th><th scope="col">Description</th></tr>
126 * <tr><th scope="row">hgrow</th><td>javafx.scene.layout.Priority</td><td>The horizontal grow priority for the child.</td></tr>
127 * <tr><th scope="row">margin</th><td>javafx.geometry.Insets</td><td>Margin space around the outside of the child.</td></tr>
128 * </table>
129 * <p>
130 * For example, if an hbox needs the TextField to be allocated all extra space:
131 * <pre><code>
132 * HBox hbox = new HBox();
|