Skip to main content

TextArea , uneditable constraint, rows, and cols

1 reply [Last post]
kawaiimomo
Offline
Joined: 2008-07-10

Hi all,

I'm trying to display a Dialog with a TextArea showing the error message. I have several questions and points:

- TextArea.setConstraint(TextArea.UNEDITABLE) doesn't work, the TextArea remains editable. It's the same if you use the constructor with constraint as param. So I only found TextArea.setEditable(false) as the working method. Comments?

- If I'm not setting a Layout to the Dialog (implicit FlowLayout), I need to override calcPreferredSize() or make calls to setPreferredW() and setPreferredH() in order to make the TextArea to fill all the Dialog. Why this behaviour?

- If the TextArea is not editable, just by setting rows to some value higher than 1 will make the Component infinitely multilined or it will multiline only the rows specified by setRows() method?

Thanks a lot. Kind Regards.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi kawaiimomo,
> - TextArea.setConstraint(TextArea.UNEDITABLE) doesn't work, the
> TextArea remains editable. It's the same if you use the constructor
> with constraint as param. So I only found TextArea.setEditable
> (false) as the working method. Comments?

setConstraint only affects the native underlying text box and so
behaves correctly.

> - If I'm not setting a Layout to the Dialog (implicit FlowLayout),
> I need to override calcPreferredSize() or make calls to
> setPreferredW() and setPreferredH() in order to make the TextArea
> to fill all the Dialog. Why this behaviour?

This is the behavior of flow layout, it gives elements their
preferred size (don't use setPreferredW/H we will remove them SOON).
Use a border layout CENTER layout if you want the text area to stretch.

> - If the TextArea is not editable, just by setting rows to some
> value higher than 1 will make the Component infinitely multilined
> or it will multiline only the rows specified by setRows() method?

This depends on the value of grows by content.

Thanks.

Shai Almog
http://lwuit.blogspot.com/

[att1.html]