How To Set Dynamic Height Of TextArea Based On Width In Java FX 2

I wish Oracle simply included this feature so developers would not have to code it from scratch. However, I came across a custom made class called ScrollFreeTextArea from the javafx-demos website.

This class simply did the trick for me. So whenever you type a long text and it wraps itself or press the ENTER key for a new line, the height of the TextArea increases without displaying the scrollbar.

Here is the complete source code.

Related Posts Plugin for WordPress, Blogger...


  1. Thank for the code!
    One question: if I set max height for scrollfreetextarea, then enter very long text, how do I set scrolling automatically to the end of the text?

Leave a Reply

Your email address will not be published. Required fields are marked *