create JavaFX Default Grid Pane - Java JavaFX

Java examples for JavaFX:GridPane

Description

create JavaFX Default 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 createDefaultGridPane() {
        return createGridPane(25, 25, 25, 25);
    }/*from   w ww .ja v  a 2 s . c o m*/

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

    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