Reputation: 127
How can I wrap the text of TextArea hint and also how can I align the hint to the top?
I tried subclassing of TextArea didn't help. I didn't find any relevant method of TextAre to achieve relevant result.
Upvotes: 1
Views: 79
Reputation: 52770
You can't. A hint is a label subclass and those are single line. Unfortunately we implemented it in a way that doesn't make this simple.
However, you can workaround it using code like this:
TextArea actualTa = ...;
TextArea hint = new TextArea("My long hint text");
hint.setEditable(false);
hint.setUIID("TextHint");
Container textAreaWithHint = LayeredLayout.enclose(actualTa, hint);
if(actualTa.getText().getLength() > 0) {
hint.setVisible(false);
}
// I'll leave that as an exercise for you...
textAreaWithHint.addFocusListener(...);
Upvotes: 1