Percent Height for GridPane Row
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.RowConstraints;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 500, 200);
stage.setScene(scene);
GridPane gridpane = new GridPane();
RowConstraints row1 = new RowConstraints();
row1.setPercentHeight(25);
RowConstraints row2 = new RowConstraints();
row2.setPercentHeight(50);
RowConstraints row3 = new RowConstraints();
row3.setPercentHeight(25);
gridpane.getRowConstraints().addAll(row1,row2,row3);
root.getChildren().add(gridpane);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Related examples in the same category