Skip to main content

Maps

28 replies [Last post]
rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hi all,
I wonder if it would be possible to create a component that can draw a tapestry wich can be moved around the screen (eg a window for maps).
It's easy using the arrow keys, but I don´t know if it is possible to do it on touch screens (listening touch events).
Thanks!

Reply viewing options

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

Hi Shai,

I had a very brief look into the reversed LWUIT code and found there are two specific wait(duration) calls:

1. In Display.java

lock.wait(50L);

2. In RunnableWrapper.java

Display.lock.wait(40L);

This will produce a maximum framerate of 20~25.

If any of this type of methods is executed in the way of applying Display.getInstance().setFramerate(rate), the framerate would have no chance to increase above 20~25.

Does this make any sense?

Thanks,

Qunhuan

-----Original Message-----
From: Qunhuan Mei
Sent: 26 June 2008 14:00
To: users@lwuit.dev.java.net
Subject: What does setFramerate(rate) actually do?

Hi,

I think the problem of unable to reasonably increase any customised component's paint rate is still there.

Seems to me that setFramerate(rate) functions like setting a graphical CPU's clock rate, probably using Timer-TimerTask pattern. It controls the EDT's despatching frequency to all customised components. Thus:

1. All applicable animate() will be called in the frequency of this "rate" (theoretically)
2. Thread.sleep(duration) is not supposed to be used anywhere in the system, since it will act upon the EDT thus change the "rate"
3. Any specific customised component's paint frequency can only be made slower (e.g. by checking the duration passed etc), but not faster than the system's "rate".

Since currently the "rate" can not be manually set to be faster before it reaches certain value (e.g. 25), I suspect in the system, the sleep method or something similar is used.

Does this make any sense?

Thanks,

Qunhuan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Chen, thanks very much for your tip below - it works!

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 26 June 2008 13:37
To: users@lwuit.dev.java.net
Subject: Re: Height issue

Hi Qunhuan,
That's true in cell renderer's you don't suppose to use them externally,
however you can try to get the actual y position like this.

y = g.getTranslateY() + getY();

Note that this is undocumented and may change in the future, so don't
count on this forever.

Regards,
Chen

Qunhuan Mei wrote:
> Hi again Chen,
>
> I figure that the cell renderer's getY() or getAbsoluteY() returns a virtual Y position which the system knows how to mapping it into physical one. The y position here is not supposed to be used for externally. Am I correct?
>
> Thanks,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 26 June 2008 12:29
> To: users@lwuit.dev.java.net
> Subject: Re: Height issue
>
> Hi Qunhuan,
> Renderer shouldn't been asked for it's position, this won't work for you.
> The Renderer is used only to help the List to paint the Item.
> What are you trying to achieve?
>
> Chen
>
>
>
> Qunhuan Mei wrote:
>
>> Sorry, corrections:
>>
>> The paint method is from MyList's cell renderer which extends DefaultListCellRenderer
>>
>> Thanks,
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
>> Sent: 26 June 2008 11:48
>> To: users@lwuit.dev.java.net
>> Subject: Height issue
>>
>> Hi,
>>
>> May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:
>>
>> I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:
>>
>> 1. the getY() seems always the same as getAbsoluteY().
>> 2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>>
>> -----Original Message-----
>> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
>> Sent: 25 June 2008 16:23
>> To: users@lwuit.dev.java.net
>> Subject: Re: compoent.getHeight() does not return the height of the component
>>
>> Hi,
>> No.
>> See previous threads on the subject, layout hasn't occurred yet at
>> this point in time.
>> Use getPreferredSize().
>>
>> Thanks,
>> Shai.
>>
>>
>>
>>> Hi,
>>>
>>> When I query a label's height, it always returns 0. The following
>>> is the code:
>>>
>>> Label label = new Label("Test);
>>> int h = label.getHeight();
>>>
>>> Is this a bug?
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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

Shai Almog

Hi Qunhuan,

> Hi Shai,
>
> I had a very brief look into the reversed LWUIT code and found
> there are two specific wait(duration) calls:
>
> 1. In Display.java
>
> lock.wait(50L);

This is in invokeAndBlock which will only hold the EDT when you are
in an invoke and block. Since this is a WAIT call a notify will wake
you up immediately and as you can see in the code there are calls to
notify whenever you call repaint.

>
> 2. In RunnableWrapper.java
>
> Display.lock.wait(40L);

This will be called from a separate thread from the EDT for a case of
a modal dialog and the same applies here.

Neither one of these calls is relevant and neither one occurs in your
painting cycle, feel free to place printouts and prove me wrong ;-)

Thanks,
Shai.

>
> This will produce a maximum framerate of 20~25.
>
> If any of this type of methods is executed in the way of applying
> Display.getInstance().setFramerate(rate), the framerate would have
> no chance to increase above 20~25.
>
> Does this make any sense?
>
> Thanks,
>
> Qunhuan
>
> -----Original Message-----
> From: Qunhuan Mei
> Sent: 26 June 2008 14:00
> To: users@lwuit.dev.java.net
> Subject: What does setFramerate(rate) actually do?
>
> Hi,
>
> I think the problem of unable to reasonably increase any customised
> component's paint rate is still there.
>
> Seems to me that setFramerate(rate) functions like setting a
> graphical CPU's clock rate, probably using Timer-TimerTask pattern.
> It controls the EDT's despatching frequency to all customised
> components. Thus:
>
> 1. All applicable animate() will be called in the frequency of
> this "rate" (theoretically)
> 2. Thread.sleep(duration) is not supposed to be used anywhere
> in the system, since it will act upon the EDT thus change the "rate"
> 3. Any specific customised component's paint frequency can
> only be made slower (e.g. by checking the duration passed etc), but
> not faster than the system's "rate".
>
> Since currently the "rate" can not be manually set to be faster
> before it reaches certain value (e.g. 25), I suspect in the system,
> the sleep method or something similar is used.
>
> Does this make any sense?
>
> Thanks,
>
> Qunhuan
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Chen, thanks very much for your tip below - it works!
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 26 June 2008 13:37
> To: users@lwuit.dev.java.net
> Subject: Re: Height issue
>
> Hi Qunhuan,
> That's true in cell renderer's you don't suppose to use them
> externally,
> however you can try to get the actual y position like this.
>
> y = g.getTranslateY() + getY();
>
> Note that this is undocumented and may change in the future, so don't
> count on this forever.
>
> Regards,
> Chen
>
>
> Qunhuan Mei wrote:
>> Hi again Chen,
>>
>> I figure that the cell renderer's getY() or getAbsoluteY() returns
>> a virtual Y position which the system knows how to mapping it into
>> physical one. The y position here is not supposed to be used for
>> externally. Am I correct?
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 26 June 2008 12:29
>> To: users@lwuit.dev.java.net
>> Subject: Re: Height issue
>>
>> Hi Qunhuan,
>> Renderer shouldn't been asked for it's position, this won't work
>> for you.
>> The Renderer is used only to help the List to paint the Item.
>> What are you trying to achieve?
>>
>> Chen
>>
>>
>>
>> Qunhuan Mei wrote:
>>
>>> Sorry, corrections:
>>>
>>> The paint method is from MyList's cell renderer which extends
>>> DefaultListCellRenderer
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>> -----Original Message-----
>>> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
>>> Sent: 26 June 2008 11:48
>>> To: users@lwuit.dev.java.net
>>> Subject: Height issue
>>>
>>> Hi,
>>>
>>> May be this issue is planned to be sorted in the future, but I
>>> just flag it, since my work is dependent on it:
>>>
>>> I have created a MyList extends List, within its paint() method,
>>> if I query a focused item's y position, the values are confusing:
>>>
>>> 1. the getY() seems always the same as getAbsoluteY().
>>> 2. when focus is nearly the end of the list, the y value returned
>>> could be larger than the screen height.
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
>>> Sent: 25 June 2008 16:23
>>> To: users@lwuit.dev.java.net
>>> Subject: Re: compoent.getHeight() does not return the height of
>>> the component
>>>
>>> Hi,
>>> No.
>>> See previous threads on the subject, layout hasn't occurred yet at
>>> this point in time.
>>> Use getPreferredSize().
>>>
>>> Thanks,
>>> Shai.
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> When I query a label's height, it always returns 0. The following
>>>> is the code:
>>>>
>>>> Label label = new Label("Test);
>>>> int h = label.getHeight();
>>>>
>>>> Is this a bug?
>>>>
>>>> Thanks,
>>>>
>>>> Qunhuan
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>> --
>>>> 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
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>

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

Qunhuan Mei

Hi again Chen,

I figure that the cell renderer's getY() or getAbsoluteY() returns a virtual Y position which the system knows how to mapping it into physical one. The y position here is not supposed to be used for externally. Am I correct?

Thanks,

Qunhuan

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 26 June 2008 12:29
To: users@lwuit.dev.java.net
Subject: Re: Height issue

Hi Qunhuan,
Renderer shouldn't been asked for it's position, this won't work for you.
The Renderer is used only to help the List to paint the Item.
What are you trying to achieve?

Chen

Qunhuan Mei wrote:
> Sorry, corrections:
>
> The paint method is from MyList's cell renderer which extends DefaultListCellRenderer
>
> Thanks,
>
> Qunhuan
>
> -----Original Message-----
> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
> Sent: 26 June 2008 11:48
> To: users@lwuit.dev.java.net
> Subject: Height issue
>
> Hi,
>
> May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:
>
> I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:
>
> 1. the getY() seems always the same as getAbsoluteY().
> 2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.
>
> Thanks,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
> Sent: 25 June 2008 16:23
> To: users@lwuit.dev.java.net
> Subject: Re: compoent.getHeight() does not return the height of the component
>
> Hi,
> No.
> See previous threads on the subject, layout hasn't occurred yet at
> this point in time.
> Use getPreferredSize().
>
> Thanks,
> Shai.
>
>
>> Hi,
>>
>> When I query a label's height, it always returns 0. The following
>> is the code:
>>
>> Label label = new Label("Test);
>> int h = label.getHeight();
>>
>> Is this a bug?
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>

---------------------------------------------------------------------
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 Qunhuan,
That's true in cell renderer's you don't suppose to use them externally,
however you can try to get the actual y position like this.

y = g.getTranslateY() + getY();

Note that this is undocumented and may change in the future, so don't
count on this forever.

Regards,
Chen

Qunhuan Mei wrote:
> Hi again Chen,
>
> I figure that the cell renderer's getY() or getAbsoluteY() returns a virtual Y position which the system knows how to mapping it into physical one. The y position here is not supposed to be used for externally. Am I correct?
>
> Thanks,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 26 June 2008 12:29
> To: users@lwuit.dev.java.net
> Subject: Re: Height issue
>
> Hi Qunhuan,
> Renderer shouldn't been asked for it's position, this won't work for you.
> The Renderer is used only to help the List to paint the Item.
> What are you trying to achieve?
>
> Chen
>
>
>
> Qunhuan Mei wrote:
>
>> Sorry, corrections:
>>
>> The paint method is from MyList's cell renderer which extends DefaultListCellRenderer
>>
>> Thanks,
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
>> Sent: 26 June 2008 11:48
>> To: users@lwuit.dev.java.net
>> Subject: Height issue
>>
>> Hi,
>>
>> May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:
>>
>> I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:
>>
>> 1. the getY() seems always the same as getAbsoluteY().
>> 2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>>
>> -----Original Message-----
>> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
>> Sent: 25 June 2008 16:23
>> To: users@lwuit.dev.java.net
>> Subject: Re: compoent.getHeight() does not return the height of the component
>>
>> Hi,
>> No.
>> See previous threads on the subject, layout hasn't occurred yet at
>> this point in time.
>> Use getPreferredSize().
>>
>> Thanks,
>> Shai.
>>
>>
>>
>>> Hi,
>>>
>>> When I query a label's height, it always returns 0. The following
>>> is the code:
>>>
>>> Label label = new Label("Test);
>>> int h = label.getHeight();
>>>
>>> Is this a bug?
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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

Qunhuan Mei

Hi,

I think the problem of unable to reasonably increase any customised component's paint rate is still there.

Seems to me that setFramerate(rate) functions like setting a graphical CPU's clock rate, probably using Timer-TimerTask pattern. It controls the EDT's despatching frequency to all customised components. Thus:

1. All applicable animate() will be called in the frequency of this "rate" (theoretically)
2. Thread.sleep(duration) is not supposed to be used anywhere in the system, since it will act upon the EDT thus change the "rate"
3. Any specific customised component's paint frequency can only be made slower (e.g. by checking the duration passed etc), but not faster than the system's "rate".

Since currently the "rate" can not be manually set to be faster before it reaches certain value (e.g. 25), I suspect in the system, the sleep method or something similar is used.

Does this make any sense?

Thanks,

Qunhuan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Chen, thanks very much for your tip below - it works!

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 26 June 2008 13:37
To: users@lwuit.dev.java.net
Subject: Re: Height issue

Hi Qunhuan,
That's true in cell renderer's you don't suppose to use them externally,
however you can try to get the actual y position like this.

y = g.getTranslateY() + getY();

Note that this is undocumented and may change in the future, so don't
count on this forever.

Regards,
Chen

Qunhuan Mei wrote:
> Hi again Chen,
>
> I figure that the cell renderer's getY() or getAbsoluteY() returns a virtual Y position which the system knows how to mapping it into physical one. The y position here is not supposed to be used for externally. Am I correct?
>
> Thanks,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 26 June 2008 12:29
> To: users@lwuit.dev.java.net
> Subject: Re: Height issue
>
> Hi Qunhuan,
> Renderer shouldn't been asked for it's position, this won't work for you.
> The Renderer is used only to help the List to paint the Item.
> What are you trying to achieve?
>
> Chen
>
>
>
> Qunhuan Mei wrote:
>
>> Sorry, corrections:
>>
>> The paint method is from MyList's cell renderer which extends DefaultListCellRenderer
>>
>> Thanks,
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
>> Sent: 26 June 2008 11:48
>> To: users@lwuit.dev.java.net
>> Subject: Height issue
>>
>> Hi,
>>
>> May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:
>>
>> I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:
>>
>> 1. the getY() seems always the same as getAbsoluteY().
>> 2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>>
>> -----Original Message-----
>> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
>> Sent: 25 June 2008 16:23
>> To: users@lwuit.dev.java.net
>> Subject: Re: compoent.getHeight() does not return the height of the component
>>
>> Hi,
>> No.
>> See previous threads on the subject, layout hasn't occurred yet at
>> this point in time.
>> Use getPreferredSize().
>>
>> Thanks,
>> Shai.
>>
>>
>>
>>> Hi,
>>>
>>> When I query a label's height, it always returns 0. The following
>>> is the code:
>>>
>>> Label label = new Label("Test);
>>> int h = label.getHeight();
>>>
>>> Is this a bug?
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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

Shai Almog

Hi,
I ran such benchmarks and setting framerate to 1000 works as expected
in our benchmarks producing performance equivalent to or exceeding
Canvas speeds (since we use game canvas).
This obviously depends on your device and benchmark methodology. Feel
free to show me a problematic sample.

Thanks,
Shai.

> Hi,
>
> I think the problem of unable to reasonably increase any customised
> component's paint rate is still there.
>
> Seems to me that setFramerate(rate) functions like setting a
> graphical CPU's clock rate, probably using Timer-TimerTask pattern.
> It controls the EDT's despatching frequency to all customised
> components. Thus:
>
> 1. All applicable animate() will be called in the frequency of
> this "rate" (theoretically)
> 2. Thread.sleep(duration) is not supposed to be used anywhere
> in the system, since it will act upon the EDT thus change the "rate"
> 3. Any specific customised component's paint frequency can
> only be made slower (e.g. by checking the duration passed etc), but
> not faster than the system's "rate".
>
> Since currently the "rate" can not be manually set to be faster
> before it reaches certain value (e.g. 25), I suspect in the system,
> the sleep method or something similar is used.
>
> Does this make any sense?
>
> Thanks,
>
> Qunhuan
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Chen, thanks very much for your tip below - it works!
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 26 June 2008 13:37
> To: users@lwuit.dev.java.net
> Subject: Re: Height issue
>
> Hi Qunhuan,
> That's true in cell renderer's you don't suppose to use them
> externally,
> however you can try to get the actual y position like this.
>
> y = g.getTranslateY() + getY();
>
> Note that this is undocumented and may change in the future, so don't
> count on this forever.
>
> Regards,
> Chen
>
>
> Qunhuan Mei wrote:
>> Hi again Chen,
>>
>> I figure that the cell renderer's getY() or getAbsoluteY() returns
>> a virtual Y position which the system knows how to mapping it into
>> physical one. The y position here is not supposed to be used for
>> externally. Am I correct?
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 26 June 2008 12:29
>> To: users@lwuit.dev.java.net
>> Subject: Re: Height issue
>>
>> Hi Qunhuan,
>> Renderer shouldn't been asked for it's position, this won't work
>> for you.
>> The Renderer is used only to help the List to paint the Item.
>> What are you trying to achieve?
>>
>> Chen
>>
>>
>>
>> Qunhuan Mei wrote:
>>
>>> Sorry, corrections:
>>>
>>> The paint method is from MyList's cell renderer which extends
>>> DefaultListCellRenderer
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>> -----Original Message-----
>>> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
>>> Sent: 26 June 2008 11:48
>>> To: users@lwuit.dev.java.net
>>> Subject: Height issue
>>>
>>> Hi,
>>>
>>> May be this issue is planned to be sorted in the future, but I
>>> just flag it, since my work is dependent on it:
>>>
>>> I have created a MyList extends List, within its paint() method,
>>> if I query a focused item's y position, the values are confusing:
>>>
>>> 1. the getY() seems always the same as getAbsoluteY().
>>> 2. when focus is nearly the end of the list, the y value returned
>>> could be larger than the screen height.
>>>
>>> Thanks,
>>>
>>> Qunhuan
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
>>> Sent: 25 June 2008 16:23
>>> To: users@lwuit.dev.java.net
>>> Subject: Re: compoent.getHeight() does not return the height of
>>> the component
>>>
>>> Hi,
>>> No.
>>> See previous threads on the subject, layout hasn't occurred yet at
>>> this point in time.
>>> Use getPreferredSize().
>>>
>>> Thanks,
>>> Shai.
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> When I query a label's height, it always returns 0. The following
>>>> is the code:
>>>>
>>>> Label label = new Label("Test);
>>>> int h = label.getHeight();
>>>>
>>>> Is this a bug?
>>>>
>>>> Thanks,
>>>>
>>>> Qunhuan
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>> --
>>>> 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
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>

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

Qunhuan Mei

Hi,

When I query a label's height, it always returns 0. The following is the code:

Label label = new Label("Test);
int h = label.getHeight();

Is this a bug?

Thanks,

Qunhuan

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

Shai Almog

Hi,
No.
See previous threads on the subject, layout hasn't occurred yet at
this point in time.
Use getPreferredSize().

Thanks,
Shai.

> Hi,
>
> When I query a label's height, it always returns 0. The following
> is the code:
>
> Label label = new Label("Test);
> int h = label.getHeight();
>
> Is this a bug?
>
> Thanks,
>
> Qunhuan
>
>
> ---------------------------------------------------------------------
> 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

Qunhuan Mei

Hi,

May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:

I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:

1. the getY() seems always the same as getAbsoluteY().
2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.

Thanks,

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 25 June 2008 16:23
To: users@lwuit.dev.java.net
Subject: Re: compoent.getHeight() does not return the height of the component

Hi,
No.
See previous threads on the subject, layout hasn't occurred yet at
this point in time.
Use getPreferredSize().

Thanks,
Shai.

> Hi,
>
> When I query a label's height, it always returns 0. The following
> is the code:
>
> Label label = new Label("Test);
> int h = label.getHeight();
>
> Is this a bug?
>
> Thanks,
>
> Qunhuan
>
>
> ---------------------------------------------------------------------
> 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

Qunhuan Mei

Sorry, corrections:

The paint method is from MyList's cell renderer which extends DefaultListCellRenderer

Thanks,

Qunhuan

-----Original Message-----
From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
Sent: 26 June 2008 11:48
To: users@lwuit.dev.java.net
Subject: Height issue

Hi,

May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:

I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:

1. the getY() seems always the same as getAbsoluteY().
2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.

Thanks,

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 25 June 2008 16:23
To: users@lwuit.dev.java.net
Subject: Re: compoent.getHeight() does not return the height of the component

Hi,
No.
See previous threads on the subject, layout hasn't occurred yet at
this point in time.
Use getPreferredSize().

Thanks,
Shai.

> Hi,
>
> When I query a label's height, it always returns 0. The following
> is the code:
>
> Label label = new Label("Test);
> int h = label.getHeight();
>
> Is this a bug?
>
> Thanks,
>
> Qunhuan
>
>
> ---------------------------------------------------------------------
> 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

Hi Qunhuan,
Renderer shouldn't been asked for it's position, this won't work for you.
The Renderer is used only to help the List to paint the Item.
What are you trying to achieve?

Chen

Qunhuan Mei wrote:
> Sorry, corrections:
>
> The paint method is from MyList's cell renderer which extends DefaultListCellRenderer
>
> Thanks,
>
> Qunhuan
>
> -----Original Message-----
> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
> Sent: 26 June 2008 11:48
> To: users@lwuit.dev.java.net
> Subject: Height issue
>
> Hi,
>
> May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:
>
> I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:
>
> 1. the getY() seems always the same as getAbsoluteY().
> 2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.
>
> Thanks,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
> Sent: 25 June 2008 16:23
> To: users@lwuit.dev.java.net
> Subject: Re: compoent.getHeight() does not return the height of the component
>
> Hi,
> No.
> See previous threads on the subject, layout hasn't occurred yet at
> this point in time.
> Use getPreferredSize().
>
> Thanks,
> Shai.
>
>
>> Hi,
>>
>> When I query a label's height, it always returns 0. The following
>> is the code:
>>
>> Label label = new Label("Test);
>> int h = label.getHeight();
>>
>> Is this a bug?
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>

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

Qunhuan Mei

Hi Chen,

Thanks for your reply. Basically I need to know the current y position of the focused list item so that I could display a dialog positioned right below or above it.

Regards,

Qunhuan

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 26 June 2008 12:29
To: users@lwuit.dev.java.net
Subject: Re: Height issue

Hi Qunhuan,
Renderer shouldn't been asked for it's position, this won't work for you.
The Renderer is used only to help the List to paint the Item.
What are you trying to achieve?

Chen

Qunhuan Mei wrote:
> Sorry, corrections:
>
> The paint method is from MyList's cell renderer which extends DefaultListCellRenderer
>
> Thanks,
>
> Qunhuan
>
> -----Original Message-----
> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
> Sent: 26 June 2008 11:48
> To: users@lwuit.dev.java.net
> Subject: Height issue
>
> Hi,
>
> May be this issue is planned to be sorted in the future, but I just flag it, since my work is dependent on it:
>
> I have created a MyList extends List, within its paint() method, if I query a focused item's y position, the values are confusing:
>
> 1. the getY() seems always the same as getAbsoluteY().
> 2. when focus is nearly the end of the list, the y value returned could be larger than the screen height.
>
> Thanks,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
> Sent: 25 June 2008 16:23
> To: users@lwuit.dev.java.net
> Subject: Re: compoent.getHeight() does not return the height of the component
>
> Hi,
> No.
> See previous threads on the subject, layout hasn't occurred yet at
> this point in time.
> Use getPreferredSize().
>
> Thanks,
> Shai.
>
>
>> Hi,
>>
>> When I query a label's height, it always returns 0. The following
>> is the code:
>>
>> Label label = new Label("Test);
>> int h = label.getHeight();
>>
>> Is this a bug?
>>
>> Thanks,
>>
>> Qunhuan
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>

---------------------------------------------------------------------
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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hi Shai,

> Nothing that I'm aware of and since the list source
> code isn't out
> yet I can't refer you to it...
Ok.

> Try something like this when to drag:
> draggedXMotion = Motion.createFrictionMotion(sourceX,
> destX, 0.0004f);
> draggedXMotion.start();
>
> public boolean animate() {
> raggedXMotion != null) {
> int xPos = draggedXMotion.getValue();
> //...
> }
> ...
> }
> thing around these lines should help you in providing
> this sort of friction motion.
At the moment, I'm using Graphics... Since I want to animate the background, I do something like this:

class MyComponent{
public void paint(Graphics g){
//I try to center the referencePoint in the screen
mymethod_calculateViewPortOffset(xy, [b]referencePoint[/b]);
g.translate(-xy[x], -xy[y]);
g.drawImage(mapImage, 0, 0);
...
}
}
On events, I modify the referencePoint and call repaint(). But your code looks better...
What do you think about this?

> Try extending Component but activate the
> setSmoothScroll(true) which
> might actually solve your problem better than the
> suggestion above.
Sure, I don´t want to reinvent the wheel... But it doesn't work; I think I´m doing something wrong...

Thank you very much.
Regards,
Rodrigo.

Shai Almog

> What do you think about this?
>
>> Try extending Component but activate the
>> setSmoothScroll(true) which
>> might actually solve your problem better than the
>> suggestion above.
> Sure, I don´t want to reinvent the wheel... But it doesn't work; I
> think I´m doing something wrong...

Hi Rodrigo,
let me think about this a bit... Do something like this, although I
think you will only get smooth scrolling on the Y axis on this
version...
If you want to writeup a test case I might be able to fix it to allow
smooth scrolling on both axis:

public class MapComponent extends Component {
private Image map;
public MapComponent() {
setSmoothScroll(true);
}

public boolean isScrollableX() {
return true;
}

public boolean isScrollableY() {
return true;
}

public void paint(Graphics g) {
g.drawImage(map, getX() + getScrollX(), getY + getScrollY());
}
}

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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hi Shai,
is there a way to upload my source code or images? I think it would be helpful, and also other people could enjoy it.
I tried to summarize and post it, but it´s a bit large because is divided into several classes...
If not, I can copy&paste the code.
Do you refer to this when you say "writeup a test case"?

Thanks,
Rodrigo.

Shai Almog

Hi Rodrigo,
you can attach a zip file to a post if its small enough just the
source and a small test image will do (no need for jars etc...
Include image only if its small/essential). Generally a 50kb zip
would seem reasonable to attach to such a post without a problem. If
you want something larger you can email it to me in person but try
not to go over 300kb since I travel on occasion and its a pain to
download large attachments.

You can also sign the JCA and request a role in lwuit-incubator which
would allow you to contribute code and test cases.

Thanks,
Shai.

> Hi Shai,
> is there a way to upload my source code or images? I think it would
> be helpful, and also other people could enjoy it.
> I tried to summarize and post it, but it´s a bit large because is
> divided into several classes...
> If not, I can copy&paste the code.
> Do you refer to this when you say "writeup a test case"?
>
> Thanks,
> Rodrigo.
> [Message sent by forum member 'rodrigolago' (rodrigolago)]
>
> http://forums.java.net/jive/thread.jspa?messageID=282723
>
> ---------------------------------------------------------------------
> 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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hi Shai,
apologize for the inconvenience, but I can´t attach any file to a post. I don´t have that option in the reply panel of the forum... And also I can´t access to your profile to see your personal email.
What can I do?

Regards,
Rodrigo.

Shai Almog

Hi Rodrigo,
simple secrete: the email of everyone at sun is first name (Shai) dot
surname (Almog) at Sun.com so Shai.Almog at Sun.com ;-)

I was able to attach pictures to previous posts but I used the email
gateway so it might be blocked when posting through the forum.

Thanks,
Shai.

> Hi Shai,
> apologize for the inconvenience, but I can´t attach any file to a
> post. I don´t have that option in the reply panel of the forum...
> And also I can´t access to your profile to see your personal email.
> What can I do?
>
> Regards,
> Rodrigo.
> [Message sent by forum member 'rodrigolago' (rodrigolago)]
>
> http://forums.java.net/jive/thread.jspa?messageID=282760
>
> ---------------------------------------------------------------------
> 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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hi Shai,
two comments:
1. I tried to use the Motion class in order to "flow" the map as well as you said, but I found a lot of problems; it looks like my component ignores the repaint() calls, or something like that...
The problem is that I didn´t found enough documentation (snippets, HOWTOs, etc).
Any sugestion?

2. I tried to extend the List object instead of Component. The movement is much more fluid but I don't know very well what is the reason.
What do you think about this?

Thanks,
Rodrigo.

Shai Almog

Hi Rodrigo,
> 1. I tried to use the Motion class in order to "flow" the map as
> well as you said, but I found a lot of problems; it looks like my
> component ignores the repaint() calls, or something like that...
> The problem is that I didn´t found enough documentation (snippets,
> HOWTOs, etc).
> Any sugestion?

Did you read the developer guide, the tutorial, the articles in the
blog???
http://lwuit.blogspot.com/

> 2. I tried to extend the List object instead of Component. The
> movement is much more fluid but I don't know very well what is the
> reason.
> What do you think about this?

The reason the motion is fluid in a list is because we use the motion
class: https://lwuit.dev.java.net/nonav/javadocs/com/sun/lwuit/
animations/Motion.html

If you have specific questions about these things I will be happy to
answer.

Thanks,
Shai.

>
> Thanks,
> Rodrigo.
> [Message sent by forum member 'rodrigolago' (rodrigolago)]
>
> http://forums.java.net/jive/thread.jspa?messageID=282482
>
> ---------------------------------------------------------------------
> 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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hello Shai,
thank you for responding so quickly.
I think that I didn´t explained very well the case ...

> Did you read the developer guide, the tutorial, the
> articles in the
> blog???
> http://lwuit.blogspot.com/
I have read these documents. Obviously I don't pretend that there is a concrete solution to my problem but, is there really an example that comes close?

> The reason the motion is fluid in a list is because
> we use the motion class
I suposed that the reason was exactly what you say.

What I don't know is precisely [b]how to use the Motion class[/b] in the context in which we are. That's why I said: "I didn't found documentation...".
Also I would like to know if extending List instead of Component is a good solution.

> If you have specific questions about these things I
> will be happy to
> answer.
Thanks again!

Greetings.

Shai Almog

Hi Rodrigo,

> I have read these documents. Obviously I don't pretend that there
> is a concrete solution to my problem but, is there really an
> example that comes close?

Nothing that I'm aware of and since the list source code isn't out
yet I can't refer you to it...

Try something like this when to drag:
draggedXMotion = Motion.createFrictionMotion(sourceX, destX, 0.0004f);
draggedXMotion.start();

public boolean animate() {
if(draggedXMotion != null) {
int xPos = draggedXMotion.getValue();
//...
}
...

}

Something around these lines should help you in providing this sort
of friction motion.

>
> What I don't know is precisely [b]how to use the Motion class[/b]
> in the context in which we are. That's why I said: "I didn't found
> documentation...".
> Also I would like to know if extending List instead of Component is
> a good solution.

Try extending Component but activate the setSmoothScroll(true) which
might actually solve your problem better than the suggestion above.

Thanks,
Shai.

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

Qunhuan Mei

Hi,

I have added to a form a logo image, a title and then a list. However, when I ask each list item's getAbsoluteY() (I suppose this should be relative to the origin of the screen), it always returns the value same as getY()(I suppose this is relative to the current component), ignoring the fact that there are two components above it.

Could you check and confirm whether this is a bug?

Thanks,

Qunhuan

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

Shai Almog

Hi Qunhuan,
if you are asking renderer items for their location this won't work
properly and you shouldn't do this...

Elements on the form should work as you expect, if they are not
please include sample code.

Thanks,
Shai.

> Hi,
>
> I have added to a form a logo image, a title and then a list.
> However, when I ask each list item's getAbsoluteY() (I suppose this
> should be relative to the origin of the screen), it always returns
> the value same as getY()(I suppose this is relative to the current
> component), ignoring the fact that there are two components above it.
>
> Could you check and confirm whether this is a bug?
>
> Thanks,
>
> Qunhuan
>
>
> ---------------------------------------------------------------------
> 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

Qunhuan Mei

Hi Shai,

I am asking the Y position in the cell renderer, thought each cell is also a component.

I suppose if getAbsoluteY() is available, it needs to return the value as the name means.

Thanks,

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 25 June 2008 15:31
To: users@lwuit.dev.java.net
Subject: Re: getAbsoloteY() always returns the value of getY() - seems to be a bug?

Hi Qunhuan,
if you are asking renderer items for their location this won't work
properly and you shouldn't do this...

Elements on the form should work as you expect, if they are not
please include sample code.

Thanks,
Shai.

> Hi,
>
> I have added to a form a logo image, a title and then a list.
> However, when I ask each list item's getAbsoluteY() (I suppose this
> should be relative to the origin of the screen), it always returns
> the value same as getY()(I suppose this is relative to the current
> component), ignoring the fact that there are two components above it.
>
> Could you check and confirm whether this is a bug?
>
> Thanks,
>
> Qunhuan
>
>
> ---------------------------------------------------------------------
> 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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

New issues.

Shai Almog

Hi Rodrigo,
sure its possible to support touch events. In fact the list supports
touch based gesture recognition (for iPhone style list dragging), we
also support physical Motion allowing you to make the gesture
navigation more fluid.

For the basic dragging just look at Component.pointerDragged which
you can override for drag events, for more advanced physics based
motions (e.g. spline etc.) see the motion class which can allow your
drag gesture to "flow" the map in a more physical object feel.

Thanks,
Shai.

> Hi all,
> I wonder if it would be possible to create a component that can
> draw a tapestry wich can be moved around the screen (eg a window
> for maps).
> It's easy using the arrow keys, but I don´t know if it is possible
> to do it on touch screens (listening touch events).
> Thanks!
> [Message sent by forum member 'rodrigolago' (rodrigolago)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280938
>
> ---------------------------------------------------------------------
> 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

rodrigolago
Offline
Joined: 2008-03-07
Points: 0

Hello, thank you for responding so quickly. I´m gonna test the solution you have proposed and I´ll put the results on this thread.

Thank you again and greetings.