create JavaFX Text Area - Java JavaFX

Java examples for JavaFX:TextArea

Description

create JavaFX Text Area

Demo Code


//package com.java2s;

import javafx.scene.control.TextArea;

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 w w  .j  a v a  2s .c o m*/

    public static TextArea createTextArea(GridPane gridPane, int colIndex,
            int rowIndex) {
        return createTextArea(gridPane, 150, 50, colIndex, rowIndex);
    }

    public static TextArea createTextArea(GridPane gridPane, int width,
            int height, int colIndex, int rowIndex) {
        TextArea textArea = new TextArea();
        textArea.setMaxHeight(height);
        textArea.setMaxWidth(width);
        textArea.setFont(defaultTextFont);
        gridPane.add(textArea, colIndex, rowIndex);

        return textArea;
    }
}

Related Tutorials