Milan Baran
Milan Baran

Reputation: 4232

Codename one label text wraping

Is there a way how to wrap text in Label into multiple rows (using with BoxLayout Y container)? Always, i get the text overflow hidden. Especially long text that should split into two or more lines.

I get it working with TextArea component and with TextArea.row set to 2 or more. But the width is a little bit tricky.

How can I set Label or TextArea width or height?

Upvotes: 2

Views: 1767

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

The label is always a single line label the solution based on text area should work just fine if it doesn't I suggest making sure that you added everything on the EDT (you can activate EDT violation detection in the simulator menu) and if you added the component after the form is shown you should use revalidate(). There is no need to define the row count.

Just for completeness here is how this would work:

TextArea lbl = new TextArea("My very long string that should break lines because its really really really really long and just won't end");
lbl.setEditable(false);
lbl.setFocusable(false);
lbl.setUIID("Label");

Upvotes: 4

Related Questions