-2

I'm working on a text box that will give information about a subject in it, but I want 1 long string to have all of the information stored in it. I would like for this string to be returned to the "next line" in that box, I'm essentially trying to create a text box in JavaFX

2 Answers2

0

If you're basically looking to create a TextField try following:

Label label1 = new Label("Name:");

TextField textField = new TextField ();

HBox hb = new HBox();

hb.getChildren().addAll(label1, textField);

hb.setSpacing(10);
Vasilisa
  • 4,604
  • 3
  • 20
  • 25
007Robin
  • 34
  • 1
  • 2
  • 9
0

So I did some more digging, and it turns out, the thing I'm looking for is called a "Text Area"

package com.jenkov.javafx.controls;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;


public class TextAreaExperiments extends Application  {


    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("TextArea Experiment 1");

        TextArea textArea = new TextArea();

        VBox vbox = new VBox(textArea);

        Scene scene = new Scene(vbox, 200, 100);
        primaryStage.setScene(scene);
        primaryStage.show();

    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}

source received from: http://tutorials.jenkov.com/javafx/textarea.html