Skip to main content

Label - multiline wrap

11 replies [Last post]
cozmint
Offline
Joined: 2004-09-18

Hi,
Is there a simple way to wrap a long label on multiple lines?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sawal_xp
Offline
Joined: 2008-02-12

i have code like this

[code]
Form f = new Form();
f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

f.getStyle().setBgColor(0xffffff);
Label poemsImageLB = new Label();

TextArea test = new TextArea();
test.setBorderPainted(false);
test.setEditable(false);
test.getStyle().setFgColor(0x000);
test.setText("Test Test Test Test Test Test Test " +
"Test Test Test Test Test Test \n" +
"Test Test Test Test Test Test Test \n" +
"Test Test Test Test Test Test \n" +
"Test Test Test Test 1313 31 3131 123 \n" +
"Test Test Test Test 1313 31 3131 123 \n" +
"Test Test Test Test 1313 31 3131 123 \n");

f.addComponent(test);
f.show();
[/code]

why not my textarea not be to multiline textArea....?
the text is show just in one line, not like i want....:)

sawal_xp
Offline
Joined: 2008-02-12

sorry, i have not to add line set to my textarea..

textArea.setRow(10);

so my problem is answer...:)

thx..

barenca
Offline
Joined: 2008-04-24
Shai Almog

You are aware that this is a LWUIT mailinglist and not a Swing
mailing list...
We support wrapping TextArea and using it as a label as documented in
many cases here, the problem with multi-line labels is in integrating
this functionality with icon support.

> What about this idea?:
> http://barenka.blogspot.com/2008/09/visual-library-and-multiline-
> label.html
>
> Thanks
> [Message sent by forum member 'barenca' (barenca)]
>
> http://forums.java.net/jive/thread.jspa?messageID=298773
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

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

[att1.html]

Shai Almog

Label isn't designed for long texts its designed to label elements
and set icons and for that purpose its reasonable on a small screen.
Obviously smaller fonts for smaller screens apply.

The next version of LWUIT will feature the ability to "ticker" labels
on the fly. You can override the look and feel to provide the "..."
behavior if you decide to do so.

Thanks,
Shai.

> Yes, I was thinking at that.
> I want to point out the useless of label in actual form. If the
> text label has more than 3 or 4 words is a big chance to have to
> scroll horizontally (if the form is scrollable) or to miss the last
> words on 128 or 176 screen width.
> Also it look better (on all components) to check the width of the
> string and replace what can not be seen with "..". This will avoid
> showing truncated characters at the edge of the component.
> Just some suggestions, thanks.
> [Message sent by forum member 'cozmint' (cozmint)]
>
> http://forums.java.net/jive/thread.jspa?messageID=281245
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

chen

Hi,
You can use an uneditable TextArea with border painted set to false.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi,
> Is there a simple way to wrap a long label on multiple lines?
>
> Thanks.
> [Message sent by forum member 'cozmint' (cozmint)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280671
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

chenf
Offline
Joined: 2008-04-29

Hi,
You can use an uneditable TextArea with border painted set to false.

Regards,
Chen

cozmint
Offline
Joined: 2004-09-18

Yes, I was thinking at that.
I want to point out the useless of label in actual form. If the text label has more than 3 or 4 words is a big chance to have to scroll horizontally (if the form is scrollable) or to miss the last words on 128 or 176 screen width.
Also it look better (on all components) to check the width of the string and replace what can not be seen with "..". This will avoid showing truncated characters at the edge of the component.
Just some suggestions, thanks.

vprise
Offline
Joined: 2003-11-07

(cross posted because the mailing list bridge is down...)

Label isn't designed for long texts its designed to label elements and set icons and for that purpose its reasonable on a small screen.
Obviously smaller fonts for smaller screens apply.

The next version of LWUIT will feature the ability to "ticker" labels on the fly. You can override the look and feel to provide the "..." behavior if you decide to do so.

Thanks,
Shai.

Qunhuan Mei

Hi there,

I have been using netbeans for LWUIT based project and never had any setting up problems.

I intended to transfer the project into eclipse(me) based but stucked ever since:

Whenever I try to rebuild the LWUIT demo using eclipse(me), the library code from LWUIT.jar simply does not go into the LWUITDemo.jar file.

I am not sure whether it is a switch setting problem somewhere which prevents the library code into destination file or more likely (personal thinking), the eclipse(me) thinks that the LWUIT’s class path structure (e.g. com/sun/....) indicates that it is not a user library, thus they will only be used for compiling but won’t be linked into the destination jar file.

Have any of you successfully built an working example based on LWUIT using eclipse(me) or any other idea?

Many thanks in advance,

Qunhuan

alexandre_pretyman
Offline
Joined: 2008-07-21

You can check out how to add the LWUIT jar to your project *correctly* in this link: http://eclipseme.org/docs/advJarFiles.html

Building the resources will be a differente matter though. I will be looking into that in the near future, if I manage to work out anything, I'll post it