Example usage for javafx.scene.control TextArea setPrefColumnCount

List of usage examples for javafx.scene.control TextArea setPrefColumnCount

Introduction

In this page you can find the example usage for javafx.scene.control TextArea setPrefColumnCount.

Prototype

public final void setPrefColumnCount(int value) 

Source Link

Usage

From source file:Main.java

private VBox getCenter() {
    Label nameLbl = new Label("Name:");
    TextField nameFld = new TextField();
    HBox.setHgrow(nameFld, Priority.ALWAYS);
    HBox nameFields = new HBox(nameLbl, nameFld);

    Label descLbl = new Label("Description:");
    TextArea descText = new TextArea();
    descText.setPrefColumnCount(20);
    descText.setPrefRowCount(5);//from   ww w. ja  va2s. c  o  m
    VBox.setVgrow(descText, Priority.ALWAYS);

    VBox center = new VBox(nameFields, descLbl, descText);
    return center;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox root = new VBox(5);

    Label textLbl = new Label("Text:");
    TextArea text = new TextArea();
    text.setPrefRowCount(10);//  w  w  w. j  a  va  2  s  . co m
    text.setPrefColumnCount(20);
    text.setWrapText(true);

    // Button to print the TextArea node
    Button printTextBtn = new Button("Print Text");
    printTextBtn.setOnAction(e -> print(text));

    // Button to print the entire scene
    Button printSceneBtn = new Button("Print Scene");
    printSceneBtn.setOnAction(e -> print(root));

    HBox buttonBox = new HBox(5, printTextBtn, printSceneBtn);

    root.getChildren().addAll(textLbl, text, buttonBox);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Printing Nodes");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Borders");
    Group root = new Group();
    Scene scene = new Scene(root, 600, 330, Color.WHITE);

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);//from  ww w .  ja va 2  s  .  c o m
    gridpane.setVgap(10);

    final TextArea cssEditorFld = new TextArea();
    cssEditorFld.setPrefRowCount(10);
    cssEditorFld.setPrefColumnCount(100);
    cssEditorFld.setWrapText(true);
    cssEditorFld.setPrefWidth(150);
    GridPane.setHalignment(cssEditorFld, HPos.CENTER);
    gridpane.add(cssEditorFld, 0, 1);

    String cssDefault = "line1;\nline2;\n";

    cssEditorFld.setText(cssDefault);

    root.getChildren().add(gridpane);
    primaryStage.setScene(scene);
    primaryStage.show();
}