Skip to main content

Bug on a textarea uneditable

7 replies [Last post]
asterfr
Offline
Joined: 2008-07-17

http://img514.imageshack.us/img514/4646/errordisplaytextareami5.png

Here you can see my problem. And here is my code :
TextArea title = new TextArea(mytitle);
//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);
c.addComponent(title);

As you can see some titles disapear because they are too big to appear completely on the screen, I want them to appear truncated.

Reply viewing options

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

Hi astfer,
can you provide code that I can compile and run?
I'm assuming you are using the most current drop of LWUIT, right?

Thanks.

> http://img514.imageshack.us/img514/4646/errordisplaytextareami5.png
>
> Here you can see my problem. And here is my code :
> TextArea title = new TextArea(mytitle);
> //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);
> c.addComponent(title);
>
> As you can see some titles disapear because they are too big to
> appear completely on the screen, I want them to appear truncated.
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=288983
>
> ---------------------------------------------------------------------
> 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

Yeah it's the last, at least I think, here's my manifest of the .jar :
Manifest-Version: 1.0

Ant-Version: Apache Ant 1.7.0

Created-By: 1.6.0_01-b06 (Sun Microsystems Inc.)

MIDlet-2: TestMidlet,,test.tst1.TestMidlet1

MIDlet-1: TestMidlet,,test.tst1.TestMidlet

MIDlet-Vendor: Vendor

MIDlet-Version: 1.0

MIDlet-Name: GraphicsUI

MicroEdition-Configuration: CLDC-1.1

MicroEdition-Profile: MIDP-2.0

I can't provide you my code because there is the server side unreachable out of my own network, but i'll try to reproduce the bug and give you the code here.

asterfr
Offline
Joined: 2008-07-17

You can find my code here : http://bantarlo.free.fr/srcj2me/src.tag.gz

Shai Almog

File not found for the link. Please try to use zip though which is
more convenient.

Thanks.

> You can find my code here : http://bantarlo.free.fr/srcj2me/src.tag.gz
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289049
>
> ---------------------------------------------------------------------
> 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

Scuseme but at my work the admins had blocked my hoster, I can't check link easily, try this one :
http://bantarlo.free.fr/srcj2mebug/src.zip

Shai Almog

Hi,
the problem is that you are using the default flow layout which works
for simple things but in this case tries to "break a line" which
isn't what you want...
I replaced it with a BoxLayout on Y axis and also improved your codes
performance a bit ;-)
[code]
public class MyRenderer extends Container implements ListCellRenderer {
private Label thumb = new Label();
private TextArea title = new TextArea();
public MyRenderer() {
setLayout(new BoxLayout(BoxLayout.X_AXIS));
Style transpa = new Style();
transpa.setBgTransparency(0);

thumb.setStyle(transpa);
addComponent(thumb);

//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);

addComponent(title);
}

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

MyObject object = (MyObject) myObject;
thumb.setIcon(object.getThumbnailImg());
title.setText(object.getTitle());
return this;
}

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

}
[/code]



> Scuse but at my work the admins had blocked my hoster, I can't
> check link easily, try this one :
> http://bantarlo.free.fr/srcj2mebug/src.zip
> [Message sent by forum member 'asterfr' (asterfr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=289065
>
> ---------------------------------------------------------------------
> 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 87.png]

asterfr
Offline
Joined: 2008-07-17

You made me really happy Shai ! Really thank you, that problem drove me made.

If someone got the same problem : don't use your renderer as a container ! There's only one renderer per list, so if do so you'll get each time the same item.