create JavaFX Check Box - Java JavaFX

Java examples for JavaFX:ChoiceBox

Description

create JavaFX Check Box

Demo Code


//package com.java2s;

import javafx.scene.control.CheckBox;

import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;

public class Main {
    private static Font defaultLabelFont = Font.font("Tahoma",
            FontWeight.LIGHT, 14);/*www .ja va  2  s.  c  o m*/

    public static CheckBox createCheckBox(GridPane gridPane, String label,
            int colIndex, int rowIndex) {
        return createCheckBox(gridPane, label, colIndex, rowIndex, 1, 1);
    }

    public static CheckBox createCheckBox(GridPane gridPane, String label,
            int colIndex, int rowIndex, int colSpan, int rowSpan) {
        CheckBox checkBox = new CheckBox(label);
        checkBox.setFont(defaultLabelFont);
        gridPane.add(checkBox, colIndex, rowIndex, colSpan, rowSpan);

        return checkBox;
    }
}

Related Tutorials