Reputation: 49
I want to make the height of my TextField
much bigger (it should take up almost half the screen). I am using this code:
concordText = new TextField("");
concordText.setPrefHeight(400);
concordText.setPrefWidth(80);
This does increase the size of the TextField
, but the text starts from the middle (as shown in the picture). How do I make it start from the beginning of the text?
Upvotes: 0
Views: 536
Reputation: 10253
Since a TextField
is only meant for a single line of text, you want to use a TextArea
instead.
In order to make the TextArea
extend to vertically to fill its available space, wrap it in a VBox
and set the VGrow priority accordingly:
TextArea textArea = new TextArea();
VBox.setVgrow(textArea, Priority.ALWAYS);
Upvotes: 3