create JavaFX Button - Java JavaFX

Java examples for JavaFX:Button

Description

create JavaFX Button

Demo Code


//package com.java2s;

import javafx.scene.control.Button;

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);//from  w  ww.j av a  2 s  . co m

    public static Button createButton(GridPane buttonPane, String label,
            int colIndex, int rowIndex) {
        Button button = new Button(label);
        button.setFont(defaultLabelFont);
        buttonPane.add(button, colIndex, rowIndex);

        return button;
    }
}

Related Tutorials