Skip to main content

TextArea bug

16 replies [Last post]
Anonymous

Hi,

the following code will paint a text area with all text on one line
(discarding the newline characters). Adding spaces somewhere
before/after \n fixes some of the newlines.

TextArea area = new TextArea(5, 50);
area.setText("azerty\n\nqwerty\n\n\n\nhohno");
this.addComponent(BorderLayout.CENTER, area);

Regards,

Francis

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

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

Reply viewing options

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

Try disabling grows by content on the text area, there is a bug in
the current version with this functionality.

> This give me a nullpointerexception, and i don't understand why
> I've tryed to use the constructor(String,int,int) and it's not very
> helpful. Have a look :
>
> http://www.imagehosting.com/][img]http://img225.imageshack.us/
> img225/1284/buguj9.png
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287610
>
> ---------------------------------------------------------------------
> 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]

asterfr
Offline
Joined: 2008-07-17
Points: 0

I've tried it but it doesn't work.

Have a nice day.

chen

Hi,
TextArea.setGrowByContent(false), we had a related in the latest drop

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> I've tried it but it doesn't work.
>
> Have a nice day.
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287997
>
> ---------------------------------------------------------------------
> 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

asterfr
Offline
Joined: 2008-07-17
Points: 0

Hum... I'm not sure to understand. Do you mean that an issue is already affected to this method for the next release ?

chen

Hi,
The grows by content had a related bug in the latest version that you
use, this is already been fixed and the fix will be part of the next drop.
In the meantime set it to false to workaround the issue.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hum... I'm not sure to understand. Do you mean that an issue is already affected to this method for the next release ?
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=288080
>
> ---------------------------------------------------------------------
> 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

Shai Almog

Did you use the correct constructor that accepts rows and columns and
pass a value higher than 1 to the rows?
Please supply sample code to reproduce your problem.

Thanks,
Shai.

> I got a problem with the Text area I don't know if it is linked
> but : I'm trying to make a list of video, I've actually one image
> and the title in a TextArea, but if the text is too big it doesn't
> appear, as if the field was empty.
>
> One more question : how can I make the TextArea adapting itself to
> the content ?
>
> Bye
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287548
>
> ---------------------------------------------------------------------
> 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]

asterfr
Offline
Joined: 2008-07-17
Points: 0

Is there some bad constructors ?

Here is the code of my renderer :

import com.sun.lwuit.Component;
import com.sun.lwuit.Container;
import com.sun.lwuit.Font;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.Label;
import com.sun.lwuit.List;
import com.sun.lwuit.list.ListCellRenderer;
import com.sun.lwuit.plaf.Style;

import fr.businessdecision.myskreen.j2meclient1.media.VideoObject;

public class VideoRenderer implements ListCellRenderer {

public Component getListCellRendererComponent(List list, Object videoObject, int position, boolean isSelected) {

Container c = new Container();

Style transpa = new Style();
transpa.setBgTransparency(0);

VideoObject video = (VideoObject) videoObject;

Label thumb = new Label(video.getThumbnailImg());
thumb.setStyle(transpa);
c.addComponent(thumb);

TextArea title = new TextArea(video.getTitle());
title.setGrowByContent(true);
title.setStyle(transpa);
title.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM,Font.STYLE_BOLD,Font.SIZE_MEDIUM));
title.setEditable(false);
title.setFocusable(false);
//title.setRows(2);

c.addComponent(title);

return c;
}

public Component getListFocusComponent(List arg0) {
Label label = new Label("");
label.getStyle().setBgTransparency(100);
label.getStyle().setBgColor(13434879);
return label;
}

}

VideoObject is just an object containing the title and a thumbnail image (loaded from an url).

Message was edited by: asterfr

Shai Almog

Hi,
the video renderer you created is not very efficient and has some
issues try this:
public class VideoRenderer extends Container implements
ListCellRenderer {
private Label thumb;
private TextArea title;
public VideoRenderer() {
thumb = new Label();
thumb.getStyle().setBgTransparency(0);
addComponent(thumb);

title = new TextArea(video.getTitle(), 2, 2);
title.setGrowByContent(true);
title.getStyle().setBgTransparency(0);
title.getStyle().setFont(Font.createSystemFont
(Font.FACE_SYSTEM,Font.STYLE_BOLD,Font.SIZE_MEDIUM));
title.setEditable(false);
title.setFocusable(false);

c.addComponent(title);
}

public Component getListCellRendererComponent(List list, Object
videoObject, int position, boolean isSelected) {
VideoObject video = (VideoObject) videoObject;

thumb.setIcon(video.getThumbnailImg());
title.setText(video.getTitle());
return this;
}

Thanks.

> Here is the code of my renderer :
>
>
> import com.sun.lwuit.Component;
> import com.sun.lwuit.Container;
> import com.sun.lwuit.Font;
> import com.sun.lwuit.TextArea;
> import com.sun.lwuit.Label;
> import com.sun.lwuit.List;
> import com.sun.lwuit.list.ListCellRenderer;
> import com.sun.lwuit.plaf.Style;
>
> import fr.businessdecision.myskreen.j2meclient1.media.VideoObject;
>
> public class VideoRenderer implements ListCellRenderer {
>
> public Component getListCellRendererComponent(List list, Object
> videoObject, int position, boolean isSelected) {
>
> Container c = new Container();
>
> Style transpa = new Style();
> transpa.setBgTransparency(0);
>
> VideoObject video = (VideoObject) videoObject;
>
> Label thumb = new Label(video.getThumbnailImg());
> thumb.setStyle(transpa);
> c.addComponent(thumb);
>
> TextArea title = new TextArea(video.getTitle());
> title.setGrowByContent(true);
> title.setStyle(transpa);
> title.getStyle().setFont(Font.createSystemFont
> (Font.FACE_SYSTEM,Font.STYLE_BOLD,Font.SIZE_MEDIUM));
> title.setEditable(false);
> title.setFocusable(false);
> //title.setRows(2);
>
> c.addComponent(title);
>
>
>
> return c;
> }
>
> public Component getListFocusComponent(List arg0) {
> Label label = new Label("");
> label.getStyle().setBgTransparency(100);
> label.getStyle().setBgColor(13434879);
> return label;
> }
>
> }
>
>
> VideoObject is just an object containing the title and a thumbnail
> image (loaded from an url).
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287593
>
> ---------------------------------------------------------------------
> 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]

asterfr
Offline
Joined: 2008-07-17
Points: 0

This give me a nullpointerexception, and i don't understand why I've tryed to use the constructor(String,int,int) and it's not very helpful. Have a look :

http://www.imagehosting.com/][img]http://img225.imageshack.us/img225/1284/buguj9.png

Francis De Brabandere

I think you mixed the rows and columns ;-)

On Fri, Jul 18, 2008 at 5:30 PM, wrote:
> This give me a nullpointerexception, and i don't understand why I've tryed to use the constructor(String,int,int) and it's not very helpful. Have a look :
>
> http://www.imagehosting.com/][img]http://img225.imageshack.us/img225/1284/buguj9.png
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287610
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

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

Shai Almog

Hi Francis,
In my current code this seems to work as expected. I made many
changes to text area so its possible that this was fixed accidentally...

Thanks,
Shai.


> Hi,
>
> the following code will paint a text area with all text on one line
> (discarding the newline characters). Adding spaces somewhere
> before/after \n fixes some of the newlines.
>
> TextArea area = new TextArea(5, 50);
> area.setText("azerty\n\nqwerty\n\n\n\nhohno");
> this.addComponent(BorderLayout.CENTER, area);
>
> Regards,
>
> Francis
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>
> ---------------------------------------------------------------------
> 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]
[Picture 75.png]

Francis De Brabandere

Shouldn't there be an empty line between azerty and qwerty? I'll send
you (tomorrow) a sceenshot of what I see using the latest drop.
Everything is on the same line.

On Thu, Jul 17, 2008 at 7:03 PM, Shai Almog wrote:
> Hi Francis,
> In my current code this seems to work as expected. I made many changes to
> text area so its possible that this was fixed accidentally...
> Thanks,
> Shai.
>
> Hi,
> the following code will paint a text area with all text on one line
> (discarding the newline characters). Adding spaces somewhere
> before/after \n fixes some of the newlines.
> TextArea area = new TextArea(5, 50);
> area.setText("azerty\n\nqwerty\n\n\n\nhohno");
> this.addComponent(BorderLayout.CENTER, area);
> Regards,
> Francis
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
> ---------------------------------------------------------------------
> 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/
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

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

Shai Almog

I think there is an empty line there.

No need to send me a screenshot, I believe you ;-)

What I was saying is that this is probably fixed for the next drop.

Thanks,
Shai.

> Shouldn't there be an empty line between azerty and qwerty? I'll send
> you (tomorrow) a sceenshot of what I see using the latest drop.
> Everything is on the same line.
>
> On Thu, Jul 17, 2008 at 7:03 PM, Shai Almog
> wrote:
>> Hi Francis,
>> In my current code this seems to work as expected. I made many
>> changes to
>> text area so its possible that this was fixed accidentally...
>> Thanks,
>> Shai.
>>
>> Hi,
>> the following code will paint a text area with all text on one line
>> (discarding the newline characters). Adding spaces somewhere
>> before/after \n fixes some of the newlines.
>> TextArea area = new TextArea(5, 50);
>> area.setText("azerty\n\nqwerty\n\n\n\nhohno");
>> this.addComponent(BorderLayout.CENTER, area);
>> Regards,
>> Francis
>> --
>> http://www.somatik.be
>> Microsoft gives you windows, Linux gives you the whole house.
>> ---------------------------------------------------------------------
>> 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/
>>
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
>
> ---------------------------------------------------------------------
> 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]

asterfr
Offline
Joined: 2008-07-17
Points: 0

I got a problem with the Text area I don't know if it is linked but : I'm trying to make a list of video, I've actually one image and the title in a TextArea, but if the text is too big it doesn't appear, as if the field was empty.

One more question : how can I make the TextArea adapting itself to the content ?

Bye

Francis De Brabandere

for the second question:

description.setGrowByContent(true);

but this is not working on my side (I set it to false), the text
always grows using the latest drop...

On Fri, Jul 18, 2008 at 2:38 PM, wrote:
> I got a problem with the Text area I don't know if it is linked but : I'm trying to make a list of video, I've actually one image and the title in a TextArea, but if the text is too big it doesn't appear, as if the field was empty.
>
> One more question : how can I make the TextArea adapting itself to the content ?
>
> Bye
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287548
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

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

asterfr
Offline
Joined: 2008-07-17
Points: 0

Thank you, I've tried this with no success.

Is this normal that it's not in the doc ?

https://lwuit.dev.java.net/javadocs/overview-summary.html