create JavaFX Grid Pane - Java JavaFX

Java examples for JavaFX:GridPane

Description

create JavaFX Grid Pane

Demo Code


//package com.java2s;
import javafx.geometry.Insets;
import javafx.geometry.Pos;

import javafx.scene.layout.GridPane;

public class Main {
    public static GridPane createGridPane(int top, int right, int bottom,
            int left) {
        return createGridPane(Pos.CENTER, top, right, bottom, left);
    }//from w  w w  .j  ava  2  s.  c o m

    public static GridPane createGridPane(Pos alignment, int top,
            int right, int bottom, int left) {
        return createGridPane(alignment, 10, 10, top, right, bottom, left);
    }

    public static GridPane createGridPane(Pos alignment, int hGap,
            int vGap, int top, int right, int bottom, int left) {
        GridPane candidateInfo = new GridPane();
        candidateInfo.setAlignment(alignment);
        candidateInfo.setHgap(hGap);
        candidateInfo.setVgap(vGap);
        candidateInfo.setPadding(new Insets(top, right, bottom, left));
        return candidateInfo;
    }
}

Related Tutorials