create JavaFX Text Field - Java JavaFX

Java examples for JavaFX:TextField

Description

create JavaFX Text Field

Demo Code


//package com.java2s;

import javafx.scene.control.TextField;

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

public class Main {
    private static Font defaultTextFont = Font.font("Tahoma",
            FontWeight.LIGHT, 12);/*from   w ww . j a  v a 2s  .c  o m*/

    public static TextField createTextField(GridPane gridPane,
            int colIndex, int rowIndex) {
        TextField textField = new TextField();
        textField.setFont(defaultTextFont);
        gridPane.add(textField, colIndex, rowIndex);

        return textField;
    }
}

Related Tutorials