1

I have a TextArea and I want its height to grow dynamically according to its content : so there is no scrollbar needed. How to achieve that ?

bharath
  • 14,283
  • 16
  • 57
  • 95

1 Answers1

1

Use setGrowByContent(true); on the TextArea.

bharath
  • 14,283
  • 16
  • 57
  • 95
  • How to know the maximum number of characters, columns, that the TextArea can contain in a row ? –  Sep 06 '11 at 15:42
  • There is no limitation for set the text on TextArea. If you want limit the character means use `setMax(..)`. And you can set the no of columns and rows on TextArea constructor. – bharath Sep 07 '11 at 05:08
  • My problem is that I want the "columns" parameter of the TextArea constructor to be close than the phone device screen display width. So how to know the maximum number of characters that a display width can accept ? –  Sep 07 '11 at 05:24
  • AFAIK you can't get maximum character in a single line on TextArea. Its automatically re-sized for different resolutions. – bharath Sep 07 '11 at 05:59
  • True. You don't need the maximum characters. We generally just use a number like 20 which is big enough to "grow" the growth is more of a function of the layout manager. E.g. BorderLayout CENTER would receive all available space where NORTH/SOUTH would receive all available width. BoxLayout Y would receive all available width and preferred height etc... – Shai Almog Sep 08 '11 at 04:46