I'm working with JavaFX scene builder and have two questions. Fisrt one:"How to add border to Pane in JavaFX scene builder?" Second one: "How to split cells in HBox?"
Asked
Active
Viewed 2,238 times
0
-
What do you mean with splittings cells in a HBox? – Klaus Eckelt Jul 23 '13 at 12:28
-
oh, i'm sorry. I meant to join cells. – Eugene Jul 25 '13 at 08:34
-
For Borders you may check out this http://stackoverflow.com/questions/18244923/javafx-fxml-how-do-i-apply-a-border-to-a-pane-or-label-in-my-gui – CN1002 Mar 23 '16 at 07:55
2 Answers
1
I dont know why you would want to join HBox cells as you can set the resize behaviour for every child of the hbox. There is a example in HBox's Javadoc:
//For example, if an hbox needs the TextField to be allocated all extra space:
HBox hbox = new HBox();
TextField field = new TextField();
HBox.setHgrow(field, Priority.ALWAYS);
hbox.getChildren().addAll(new Label("Search:"), field, new Button("Go"));
Joining cells would be possible in a GridPane with the row- and/or columnSpan.
GridPane gridpane = new GridPane();
gridpane.add(new Button(), 0, 0, 2, 2); // column=0 row=0, spans over 2 columns and 2 rows
gridpane.add(new Label(), 3, 1); // column=3 row=1 (spans over 1 column and 1 row (default))
row-/columnSpan and the vertical horizontal Grow can be specified in the Properties bar of the Scene Builder, residing on the right side, by default.

Klaus Eckelt
- 676
- 4
- 12
0
You can set border by using setStyle() and use some styles like -fx-border examples
P.S. styles are the same, as like css, but with -fx-
prefix

lummycoder
- 588
- 1
- 7
- 20