0

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?"

Eugene
  • 11
  • 6

2 Answers2

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