I have been trying to make the TextArea grow with its content, for exmaple:
There is one Line in the Text area, now the user keeps writing and reaches the TextArea's right border and the text wraps, now he does have a second line (which is not wrapped by simply using '\n' internally) and I now want the text field to grow for the height of one more line.
What I have tried already:
This
Text text = textArea.lookup(".text").getLocalBounds.getHeight()
always returns the same, no matter how much Lines i do have.
This
textArea.getPrefRowCount()
always returns
1
no matter how much lines I have.
How can I achieve this? If someone wants a working example, Skype has that kind of mechanism in its chat.
This
Text text = (Text) textArea.lookup(".text");
textArea.setPrefHeight(text.boundsInParentProperty().get().getMaxY());
works but is not very nice since the scroll bars keep bugging.