Skip to main content

List and line breaks

9 replies [Last post]
dunae
Offline
Joined: 2008-06-09
Points: 0

I have a component List. I need introduce many characters. How can I enter line breaks? Is it possible?

Thanks.

Reply viewing options

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

Hi Matteo,
please check the following in your component:

1. Check that you overrode Graphics correctly and using
com.sun.lwuit.Graphics rather than javax.microedition.lcdui.Graphics

2. Check that the component is indeed added to the form correctly and
is within the hierarchy of a form.

3. Check that calcPreferredSize is invoked and returns a large enough
value.

4. Before going into the tabbed pane etc... Try the following:
Form myForm = new Form("Test");
myForm.setLayout(new BorderLayout());
myForm.addComponent(BorderLayout.CENTER, new HorizontalRule());
myForm.show();

This should work since the border layout center will stretch the
component across the entire form.

Thanks,
Shai.

> Hi, just tried implementing the calcPreferredSize method, but still
> the
> paint method (nor calcPreferredSize) is not called (as the debug
> message is
> not printed to the System.out)
>
> When exactly the paint method is called?
> I'm actually replacing an existent form component with a
> TabbedPane, to
> which I added my custom component. I guess this is not different from
> creating a new form and adding a component to it, is it?
> Anyhow, I'm stuck with the paint method not being called :\
>
>
>
>
>> -----Messaggio originale-----
>> Da: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Inviato: lunedì 9 giugno 2008 15.44
>> A: users@lwuit.dev.java.net
>> Oggetto: Re: Custom component not painted
>>
>> Hi Matteo,
>> My best guess is that your widget didn't got any size, what
>> you need to do is to implement the protected Dimension
>> calcPreferredSize() method, this will allow the Layout
>> manager go give a size to your Component.
>>
>> Regards,
>> Chen
>>
>> Matteo Mazzotti wrote:
>>> Hi all,
>>> I created a custom component (a HorizontalRule).
>>>
>>> Then tried to append it to a form:
>>> Form f = new Form();
>>> f.addComponent(new HorizontalRule());
>>> f.show();
>>>
>>> The horizontalRule paint method
>>>
>>> public void paint(Graphics g) {
>>> System.out.println("got called");
>>> g.doSomething...
>>> }
>>>
>>> is never called. The last thing to be called is
>> HorizontalRule constructor.
>>> What is missing in my code? To me it looks identical to your
>>> ProgressIndicator in the LWUITDemo...
>>>
>>>
>>> Thanks!
>>> Matteo
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
>
> ---------------------------------------------------------------------
> 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

Create your own renderer for the List that uses TextArea to renderer the
List.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> I have a component List. I need introduce many characters. How can I enter line breaks? Is it possible?
>
> Thanks.
> [Message sent by forum member 'dunae' (dunae)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279131
>
> ---------------------------------------------------------------------
> 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

dunae
Offline
Joined: 2008-06-09
Points: 0

Thanks. I create my own renderer and It's perfect.

dunae
Offline
Joined: 2008-06-09
Points: 0

Hi,

Is there any way to show a long paragraph with multilines (i.e. to show news or similar) in a form? Logically, the fix should not use a textarea as there is no way to eliminate the borders of these ones and they will always seems to be editable.

Regards.

chen

you can all to TextArea.setBorderPainted(false) to remove the borders

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi,
>
> Is there any way to show a long paragraph with multilines (i.e. to show news or similar) in a form? Logically, the fix should not use a textarea as there is no way to eliminate the borders of these ones and they will always seems to be editable.
>
> Regards.
> [Message sent by forum member 'dunae' (dunae)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279395
>
> ---------------------------------------------------------------------
> 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

Matteo Mazzotti

Hi all,
I created a custom component (a HorizontalRule).

Then tried to append it to a form:
Form f = new Form();
f.addComponent(new HorizontalRule());
f.show();

The horizontalRule paint method

public void paint(Graphics g) {
System.out.println("got called");
g.doSomething...
}

is never called. The last thing to be called is HorizontalRule constructor.
What is missing in my code? To me it looks identical to your
ProgressIndicator in the LWUITDemo...

Thanks!
Matteo

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

chen

Hi Matteo,
My best guess is that your widget didn't got any size, what you need to
do is to implement the protected Dimension calcPreferredSize() method,
this will allow the Layout manager go give a size to your Component.

Regards,
Chen

Matteo Mazzotti wrote:
> Hi all,
> I created a custom component (a HorizontalRule).
>
> Then tried to append it to a form:
> Form f = new Form();
> f.addComponent(new HorizontalRule());
> f.show();
>
> The horizontalRule paint method
>
> public void paint(Graphics g) {
> System.out.println("got called");
> g.doSomething...
> }
>
> is never called. The last thing to be called is HorizontalRule constructor.
> What is missing in my code? To me it looks identical to your
> ProgressIndicator in the LWUITDemo...
>
>
> Thanks!
> Matteo
>
>
>
>
> ---------------------------------------------------------------------
> 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

Matteo Mazzotti

Hi, just tried implementing the calcPreferredSize method, but still the
paint method (nor calcPreferredSize) is not called (as the debug message is
not printed to the System.out)

When exactly the paint method is called?
I'm actually replacing an existent form component with a TabbedPane, to
which I added my custom component. I guess this is not different from
creating a new form and adding a component to it, is it?
Anyhow, I'm stuck with the paint method not being called :\

> -----Messaggio originale-----
> Da: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Inviato: lunedì 9 giugno 2008 15.44
> A: users@lwuit.dev.java.net
> Oggetto: Re: Custom component not painted
>
> Hi Matteo,
> My best guess is that your widget didn't got any size, what
> you need to do is to implement the protected Dimension
> calcPreferredSize() method, this will allow the Layout
> manager go give a size to your Component.
>
> Regards,
> Chen
>
> Matteo Mazzotti wrote:
> > Hi all,
> > I created a custom component (a HorizontalRule).
> >
> > Then tried to append it to a form:
> > Form f = new Form();
> > f.addComponent(new HorizontalRule());
> > f.show();
> >
> > The horizontalRule paint method
> >
> > public void paint(Graphics g) {
> > System.out.println("got called");
> > g.doSomething...
> > }
> >
> > is never called. The last thing to be called is
> HorizontalRule constructor.
> > What is missing in my code? To me it looks identical to your
> > ProgressIndicator in the LWUITDemo...
> >
> >
> > Thanks!
> > Matteo
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > 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
>
>

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

Matteo Mazzotti

Sorry, ignore my last message. I'd forgot to uncomment line. It seems to be
working now, thanks

> -----Messaggio originale-----
> Da: Matteo Mazzotti [mailto:m.mazzotti@p-tel.it]
> Inviato: lunedì 9 giugno 2008 15.58
> A: users@lwuit.dev.java.net
> Oggetto: R: Custom component not painted
>
> Hi, just tried implementing the calcPreferredSize method, but
> still the paint method (nor calcPreferredSize) is not called
> (as the debug message is not printed to the System.out)
>
> When exactly the paint method is called?
> I'm actually replacing an existent form component with a
> TabbedPane, to which I added my custom component. I guess
> this is not different from creating a new form and adding a
> component to it, is it?
> Anyhow, I'm stuck with the paint method not being called :\
>
>
>
>
> > -----Messaggio originale-----
> > Da: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> > Inviato: lunedì 9 giugno 2008 15.44
> > A: users@lwuit.dev.java.net
> > Oggetto: Re: Custom component not painted
> >
> > Hi Matteo,
> > My best guess is that your widget didn't got any size, what
> you need
> > to do is to implement the protected Dimension
> > calcPreferredSize() method, this will allow the Layout
> manager go give
> > a size to your Component.
> >
> > Regards,
> > Chen
> >
> > Matteo Mazzotti wrote:
> > > Hi all,
> > > I created a custom component (a HorizontalRule).
> > >
> > > Then tried to append it to a form:
> > > Form f = new Form();
> > > f.addComponent(new HorizontalRule()); f.show();
> > >
> > > The horizontalRule paint method
> > >
> > > public void paint(Graphics g) {
> > > System.out.println("got called");
> > > g.doSomething...
> > > }
> > >
> > > is never called. The last thing to be called is
> > HorizontalRule constructor.
> > > What is missing in my code? To me it looks identical to your
> > > ProgressIndicator in the LWUITDemo...
> > >
> > >
> > > Thanks!
> > > Matteo
> > >
> > >
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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
> >
> >
>
>
>
> ---------------------------------------------------------------------
> 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