Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The probably easiest way would be to use a VBox:</p> <pre><code>public void start(final Stage stage) throws Exception { final Button button0 = new Button("Start learning"); final Button button1 = new Button("Customize"); final VBox box = new VBox(); box.setFillWidth(true); box.getChildren().setAll(button0, button1); box.setAlignment(Pos.CENTER); stage.setScene(new Scene(box)); stage.setWidth(200); stage.setHeight(100); stage.show(); } </code></pre> <p>Another possible way of doing this is with a GridPane:</p> <pre><code>public void start(final Stage stage) throws Exception { final Button button0 = new Button("Start learning"); final Button button1 = new Button("Customize"); final GridPane cPane = new GridPane(); cPane.getChildren().addAll(button0, button1); GridPane.setConstraints(button0, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER); GridPane.setConstraints(button1, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER); final ColumnConstraints columnn0 = new ColumnConstraints(); columnn0.setPercentWidth(100); cPane.getColumnConstraints().addAll(columnn0); final RowConstraints row0 = new RowConstraints(1); row0.setPercentHeight(50); final RowConstraints row1 = new RowConstraints(1); row1.setPercentHeight(50); cPane.getRowConstraints().addAll(row0, row1); stage.setScene(new Scene(cPane)); stage.setWidth(200); stage.setHeight(100); stage.show(); } </code></pre> <p>The idea here would be to configure the rows and columns in the grid to fill your scene using the according constraints objects. The above defines one column and two rows. You can then align your components within the cells of the Grid, using GridPane.setConstraints(...). </p> <p>You might want to alter the code slightly to have the top button align to VPos.BOTTOM and the lower one to VPos.TOP, depending on whether you want the buttons to stick together (you'll then have to define a margin for both, of course).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload