Friday, March 6, 2020

Friday Fun LXII - Expandable TextArea

Aloha,

Today I have another little JavaFX control for you that is an expandable TextArea.
This is a TextArea as you know it but with the ability to grow/shrink it's size dependent on it's content. Meaning to say it doesn't have scroll bars.
You can define a fixed number of lines that will be used to calculate the height when the control is not expandable and when you set expandable = true it will automatically resize to the size it's defined by it's content.
In addition it comes with the ability to limit the amount of characters you can type into the text area.
To give the user a hint that the limit is near you can also define the character threshold that will be used to show a little label below the text area that shows the characters left before you reach the limit.
For example you limit the amount of characters to 300 and set the threshold to 50. In this case the label will appear as soon as you reach 250 characters.
Here is a little screenshot that shows how the ExpandableTextArea looks like:



In addition I've also created a little video over at youtube that shows the control in action.



And as always the source code is available at github.

That's it for today...enjoy the upcoming weekend and...keep coding...

No comments:

Post a Comment