Skip to main content

Auto completion in ComboBox

33 replies [Last post]
ckurtm
Offline
Joined: 2008-03-12
Points: 0

Hi, I have a combo box with more that 20 listings, wanted to find out if theres a way of making it possible to autocomplete for an entry in the combobox,
Say if i have a list {"one","two","three"}

typing "t" would go and select the first occurance of t in the combobox list.

Hope this makes sense

Reply viewing options

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

Hi Qunhuan,
I just posted a blog entry explaining how to implement a ticker in a
selected item in the list:
http://lwuit.blogspot.com/2008/06/implementing-selected-item-ticker-
in.html

Hope this answers your question.

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

Thanks very much INDEED. It works perfect. (Sorry I did not reply you
promptly since I was off work yesterday).

Have a nice day!

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 17 June 2008 20:55
To: users@lwuit.dev.java.net
Subject: Re: LWUIT to fully excel J2ME platform's competitors, e.g.
FlashLite.

Hi Qunhuan,
I just posted a blog entry explaining how to implement a ticker in a
selected item in the list:
http://lwuit.blogspot.com/2008/06/implementing-selected-item-ticker-
in.html

Hope this answers your question.

Thanks,
Shai.

---------------------------------------------------------------------
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,
I'm not exactly sure I understand the points in this message so let
me address a few of them.

First, we don't think of FlashLite as a competitor if anything Flash
is closer in features to SVG/Media API's although I wouldn't consider
it quite similar.
I don't want to talk too much about Flash though since these
discussions often degrade into religious wars.

> Using LWUIT's methods available to the developer, I have so far failed
> to see the feasibility of this list scrolling animation approach.

When I get the time I will write exactly how to do this. The full
flexibility is there and it would not require a new code drop to use
this.

> suppose we have a very long text, after the tail of the long
> text is shown, the head of the text needs to be appearing, say with a
> dozen or two pixels behind - I use font.height.

Thats also very easy to accomplish.

> LWUIT obviously made a huge leap forward already. But seems to me in
> some aspect it is still not as capable as FlashLite. I remember during
> my visit to the MobileWorldCongress2008, on Adobe's stand, I saw their
> new list based UI, which involves vertical text scrolling (i.e. a list
> cell in focus always come together with a rectangular area which does
> the vertical text scrolling - it looks very cool).

When programming in Flash you generally build the whole rendering
logic on the fly including all the drawing. This would work great for
a hardcoded list of a small number of elements, but when you try to
scale this or connect it to a data source you run into problems...
The same problems exist with SVG which would allow you to build a
very similar list to the one you saw demonstrated.
Unlike Flash we allow you to use SVG Vector Graphics and 3D graphics
together on a device to create REALLY stunning UI's. One of the
misunderstood features of LWUIT is the 3D transitions, I didn't build
them because they were necessary... I built them to inspire.
In the past I was in a project that leveraged JSR 184 to build a 3D
carousel UI for Orange France/UK, very cool project that truly
stretched UI boundaries on the cell phone and looked much better than
the Flash mockups we got from the designers.

Thanks,
Shai.
>
>
> -----Original Message-----
> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
> Sent: 17 June 2008 11:52
> To: users@lwuit.dev.java.net
> Subject: Re: Any way to know current list cell's y position?
>
> Hi Qunhuan,
> the same approach should apply here, this is a very common "ticker"
> use case where the selected list element "scrolls".
> We intend to add this functionality as part of the framework in a
> future drop but right now its relatively easy to do...
>
> It should work exactly as I illustrated in the previous email but if
> you are having trouble I'll try to hack up a working example on the
> blog but that might take me some time....
>
> Thanks,
> Shai.
>
>> Hi Shai,
>>
>> I am SO sorry that I just realised that the working code is actually
>> based on my "HARD CODED" cell position I did yesterday. So I am now
>> back
>> to the beginning :(.
>>
>> The current situation is (using "MyList extends List") :
>>
>> The paint method from List is looking after the drawing of the whole
>> list, i.e. all the list cells, not one cell a time based on multiple
>> paint calls. When there is no animation, the paint() will be called
>> once. When animation is needed, the paint() needs to be called
>> continuously to keep the FRAME going. There is no physical cell info
>> available. (hasFocus() here is nothing to do with any specific cell
>> but
>> to the whole list).
>>
>> If the animation is something based on indexed images or alike, the
>> animation can be achieved based on changing image reference before a
>> frame is painted (i.e. changing frame data).
>>
>> However, my animation request is different, which is to scroll
>> specific
>> cell text horizontally (one pixel a time). It may also involve
>> changing
>> font for that specific cell. Using g.translate(...) does not work
>> since
>> at least it applies to the whole list, not to a single list cell.
>>
>> Do you still see an approach match here?
>>
>> Qunhuan
>>
>>
>> -----Original Message-----
>> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
>> Sent: 17 June 2008 10:44
>> To: users@lwuit.dev.java.net
>> Subject: RE: Any way to know current list cell's y position?
>>
>> Hi Shai,
>>
>> Forgive my silliness here - I was about to change my approach after
>> failing to see the ideal result. But I forced myself to try once more
>> after receiving your message since I think if two gurus are
>> sticking to
>> an approach, the problem must be on my side.
>>
>> ... Now, it is fully working!
>>
>> Thanks very much INDEED to both of you!
>>
>> Have a great day!
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
>> Sent: 16 June 2008 20:12
>> To: users@lwuit.dev.java.net
>> Subject: Re: Any way to know current list cell's y position?
>>
>> Hi Qunhuan,
>> what Chen was saying is this:
>>
>> When List.animate() returns true, its paint method will draw all
>> visible renderer areas. Assuming we would provide you with such a
>> feature it would "collide" with the lists drawing of the cell
>> renderer... So even if you could calculate that location it just
>> wouldn't work as you would want.
>>
>> The solution is very simple though, while you must implement
>> List.animate() to perform the animation portion you can do the
>> physical animation within MyRenderer.paint(Graphics). Such as:
>>
>> // within list
>> public boolean animate() {
>> // update timer
>> // if timer elapsed
>> if(timer > 500) {
>> time = 0;
>> ticker++;
>> return true;
>> }
>> return false;
>> }
>>
>>
>> // within renderer
>> public void paint(Graphics g) {
>> // if this is the selected entry then I only want to animate
>> that...
>> if(hasFocus()) {
>> // perform animation drawing e.g. ticker translation
>> return;
>> }
>> // standard renderer code
>> //...
>> }
>>
>> Hope this is clear,
>> Thanks,
>> Shai.
>>
>>
>>> Hi Chen,
>>>
>>> Thanks for your reply. But I am not very sure if I fully understand
>>> your approach here. The problem I am facing is, for example, where
>>> should be a list's 30th cell position (Y) on the screen, if I need
>>> to draw an animation within the cell (e.g. a ticker).
>>>
>>> Within the paint() method of MyList, getX() and getY() always
>>> returns the top left corner of the list, not the list cell's.
>>> The list cell's Y position in focus is affected by FIXED_CENTER,
>>> FIEXED_LEAD, ... etc and the logic how these actually works in
>>> LWUIT. Manual work has to take into considerations of all these
>>> factors.
>>>
>>> But the consideration of these factors has already been done in
>>> LWUIT's unexposed part.
>>>
>>> Regards,
>>>
>>> qunhuan
>>>
>>>
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>>> Sent: 16 June 2008 16:58
>>> To: users@lwuit.dev.java.net
>>> Subject: Re: Any way to know current list cell's y position?
>>>
>>> Hi Qunhuan,
>>> You don't need to look for the animation position.
>>> What you need to do is to update the animation state in the list
>>> animation and to use the variables you changed in your list
>>> renderer.
>>> For ex:
>>> If you would like to implement a text ticker in the list, increase a
>>> counter in the animate method and use the modified counter in the
>>> renderer(for selected state), all the painting logic should be
>>> placed in
>>> the renderer.
>>>
>>> Regards,
>>> Chen
>>>
>>>
>>>> Hi,
>>>>
>>>> I have created a class of MyList which "extends List". For each
>>>> list cell, I need to look after its drawing or animation.
>>>> I was wondering if there is any way to know the Y position of
>>>> current selected/focused list cell (I failed to find), or if there
>>>> is any hidden method of such could be made available outside the
>>>> LWUIT?
>>>>
>>>> To manually work out a cell's Y position is possible but would be
>>>> a bit ugly.
>>>>
>>>> Could you help please?
>>>>
>>>> Qunhuan
>>>>
>>>> -----Original Message-----
>>>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>>>> Sent: 04 June 2008 17:30
>>>> To: users@lwuit.dev.java.net
>>>> Subject: Re: Is it a bug from the CellRenderer handling logic
>>>>
>>>> Hi Qunhuan,
>>>> The List uses the Renderer to paint all elements therefore it is
>>>> not a
>>>> usual Component that has a parent or a state.
>>>> Try the following to enable this feature:
>>>> Extend the List Component and override the List animate method:
>>>>
>>>> class MyList extends List{
>>>>
>>>> public boolean animate(){
>>>> boolean retVal = super.animate();
>>>> //if the List is in the middle of an animation(usually when
>>>> scrolling), don't interrupt
>>>> if(retVal){
>>>> return retVal;
>>>> }
>>>> //preform your animate code here...
>>>> }
>>>>
>>>> }
>>>>
>>>> Then make sure the renderer uses the the variables you modified in
>>>> the
>>>> animate code above correctly.
>>>> For ex:
>>>> If you try to create a Ticker like functionality inside the List
>>>> Renderer make sure only the selected item in the renderer uses the
>>>> variables you modified above or else all cells will use the
>>>> animation.
>>>> Be aware that this approach might cause some performance penalty
>>>> since
>>>> the List iterate over all the visible elements every time animate
>>>> returns true.
>>>>
>>>> Regards,
>>>> Chen
>>>>
>>>>
>>>>
>>>>
>>>> Qunhuan Mei wrote:
>>>>
>>>>> Greetings!
>>>>>
>>>>> After I managed to implement an animation handling logic for a
>>>>> Label content, I am hoping to have my own cell renderer for a
>>>>> List so that I can do some animation on any List's cell content
>>>>> in focus. The List has been added to a Form in a usual way.
>>>>>
>>>>> The way I implemented my own cell render is also usual:
>>>>>
>>>>> public class CellRenderer extends DefaultListCellRenderer {
>>>>> ......
>>>>> public void paint(Graphics g){
>>>>> ......
>>>>> }
>>>>> public boolean animate() {
>>>>> return needsAnimation; //
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>> Or (also tried)
>>>>>
>>>>> public class CellRenderer extends Label implements
>>>>> ListCellRenderer, Animation {
>>>>> ......
>>>>> public void paint(Graphics g){
>>>>> ......
>>>>> }
>>>>> public boolean animate() {
>>>>> return needsAnimation; //
>>>>> }
>>>>> }
>>>>>
>>>>> I managed to paint the cell content in my own way statically,
>>>>> that is, without animation.
>>>>>
>>>>> However, I failed in painting in animated way.
>>>>>
>>>>> What I did was inside paint(Graphics g) method, I call
>>>>> getComponentForm().registerAnimated(this);
>>>>>
>>>>> But the problem is getCompoentForm() always return null.
>>>>>
>>>>> I then try to use form.registerAnimated(this), where the form is
>>>>> the one which list is added to.
>>>>>
>>>>> After this registration, anmate() has been called endlessly while
>>>>> it always returns true. However, the problem is paint() is only
>>>>> called once and no successive calls at all, thus making animation
>>>>> logic fail.
>>>>>
>>>>> Any clue for correcting this or is it a bug?
>>>>>
>>>>> Many 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,
the same approach should apply here, this is a very common "ticker"
use case where the selected list element "scrolls".
We intend to add this functionality as part of the framework in a
future drop but right now its relatively easy to do...

It should work exactly as I illustrated in the previous email but if
you are having trouble I'll try to hack up a working example on the
blog but that might take me some time....

Thanks,
Shai.

> Hi Shai,
>
> I am SO sorry that I just realised that the working code is actually
> based on my "HARD CODED" cell position I did yesterday. So I am now
> back
> to the beginning :(.
>
> The current situation is (using "MyList extends List") :
>
> The paint method from List is looking after the drawing of the whole
> list, i.e. all the list cells, not one cell a time based on multiple
> paint calls. When there is no animation, the paint() will be called
> once. When animation is needed, the paint() needs to be called
> continuously to keep the FRAME going. There is no physical cell info
> available. (hasFocus() here is nothing to do with any specific cell
> but
> to the whole list).
>
> If the animation is something based on indexed images or alike, the
> animation can be achieved based on changing image reference before a
> frame is painted (i.e. changing frame data).
>
> However, my animation request is different, which is to scroll
> specific
> cell text horizontally (one pixel a time). It may also involve
> changing
> font for that specific cell. Using g.translate(...) does not work
> since
> at least it applies to the whole list, not to a single list cell.
>
> Do you still see an approach match here?
>
> Qunhuan
>
>
> -----Original Message-----
> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
> Sent: 17 June 2008 10:44
> To: users@lwuit.dev.java.net
> Subject: RE: Any way to know current list cell's y position?
>
> Hi Shai,
>
> Forgive my silliness here - I was about to change my approach after
> failing to see the ideal result. But I forced myself to try once more
> after receiving your message since I think if two gurus are
> sticking to
> an approach, the problem must be on my side.
>
> ... Now, it is fully working!
>
> Thanks very much INDEED to both of you!
>
> Have a great day!
>
> Qunhuan
>
> -----Original Message-----
> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
> Sent: 16 June 2008 20:12
> To: users@lwuit.dev.java.net
> Subject: Re: Any way to know current list cell's y position?
>
> Hi Qunhuan,
> what Chen was saying is this:
>
> When List.animate() returns true, its paint method will draw all
> visible renderer areas. Assuming we would provide you with such a
> feature it would "collide" with the lists drawing of the cell
> renderer... So even if you could calculate that location it just
> wouldn't work as you would want.
>
> The solution is very simple though, while you must implement
> List.animate() to perform the animation portion you can do the
> physical animation within MyRenderer.paint(Graphics). Such as:
>
> // within list
> public boolean animate() {
> // update timer
> // if timer elapsed
> if(timer > 500) {
> time = 0;
> ticker++;
> return true;
> }
> return false;
> }
>
>
> // within renderer
> public void paint(Graphics g) {
> // if this is the selected entry then I only want to animate
> that...
> if(hasFocus()) {
> // perform animation drawing e.g. ticker translation
> return;
> }
> // standard renderer code
> //...
> }
>
> Hope this is clear,
> Thanks,
> Shai.
>
>
>> Hi Chen,
>>
>> Thanks for your reply. But I am not very sure if I fully understand
>> your approach here. The problem I am facing is, for example, where
>> should be a list's 30th cell position (Y) on the screen, if I need
>> to draw an animation within the cell (e.g. a ticker).
>>
>> Within the paint() method of MyList, getX() and getY() always
>> returns the top left corner of the list, not the list cell's.
>> The list cell's Y position in focus is affected by FIXED_CENTER,
>> FIEXED_LEAD, ... etc and the logic how these actually works in
>> LWUIT. Manual work has to take into considerations of all these
>> factors.
>>
>> But the consideration of these factors has already been done in
>> LWUIT's unexposed part.
>>
>> Regards,
>>
>> qunhuan
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 16 June 2008 16:58
>> To: users@lwuit.dev.java.net
>> Subject: Re: Any way to know current list cell's y position?
>>
>> Hi Qunhuan,
>> You don't need to look for the animation position.
>> What you need to do is to update the animation state in the list
>> animation and to use the variables you changed in your list renderer.
>> For ex:
>> If you would like to implement a text ticker in the list, increase a
>> counter in the animate method and use the modified counter in the
>> renderer(for selected state), all the painting logic should be
>> placed in
>> the renderer.
>>
>> Regards,
>> Chen
>>
>>
>>> Hi,
>>>
>>> I have created a class of MyList which "extends List". For each
>>> list cell, I need to look after its drawing or animation.
>>> I was wondering if there is any way to know the Y position of
>>> current selected/focused list cell (I failed to find), or if there
>>> is any hidden method of such could be made available outside the
>>> LWUIT?
>>>
>>> To manually work out a cell's Y position is possible but would be
>>> a bit ugly.
>>>
>>> Could you help please?
>>>
>>> Qunhuan
>>>
>>> -----Original Message-----
>>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>>> Sent: 04 June 2008 17:30
>>> To: users@lwuit.dev.java.net
>>> Subject: Re: Is it a bug from the CellRenderer handling logic
>>>
>>> Hi Qunhuan,
>>> The List uses the Renderer to paint all elements therefore it is
>>> not a
>>> usual Component that has a parent or a state.
>>> Try the following to enable this feature:
>>> Extend the List Component and override the List animate method:
>>>
>>> class MyList extends List{
>>>
>>> public boolean animate(){
>>> boolean retVal = super.animate();
>>> //if the List is in the middle of an animation(usually when
>>> scrolling), don't interrupt
>>> if(retVal){
>>> return retVal;
>>> }
>>> //preform your animate code here...
>>> }
>>>
>>> }
>>>
>>> Then make sure the renderer uses the the variables you modified in
>>> the
>>> animate code above correctly.
>>> For ex:
>>> If you try to create a Ticker like functionality inside the List
>>> Renderer make sure only the selected item in the renderer uses the
>>> variables you modified above or else all cells will use the
>>> animation.
>>> Be aware that this approach might cause some performance penalty
>>> since
>>> the List iterate over all the visible elements every time animate
>>> returns true.
>>>
>>> Regards,
>>> Chen
>>>
>>>
>>>
>>>
>>> Qunhuan Mei wrote:
>>>
>>>> Greetings!
>>>>
>>>> After I managed to implement an animation handling logic for a
>>>> Label content, I am hoping to have my own cell renderer for a
>>>> List so that I can do some animation on any List's cell content
>>>> in focus. The List has been added to a Form in a usual way.
>>>>
>>>> The way I implemented my own cell render is also usual:
>>>>
>>>> public class CellRenderer extends DefaultListCellRenderer {
>>>> ......
>>>> public void paint(Graphics g){
>>>> ......
>>>> }
>>>> public boolean animate() {
>>>> return needsAnimation; //
>>>> }
>>>> }
>>>>
>>>>
>>>> Or (also tried)
>>>>
>>>> public class CellRenderer extends Label implements
>>>> ListCellRenderer, Animation {
>>>> ......
>>>> public void paint(Graphics g){
>>>> ......
>>>> }
>>>> public boolean animate() {
>>>> return needsAnimation; //
>>>> }
>>>> }
>>>>
>>>> I managed to paint the cell content in my own way statically,
>>>> that is, without animation.
>>>>
>>>> However, I failed in painting in animated way.
>>>>
>>>> What I did was inside paint(Graphics g) method, I call
>>>> getComponentForm().registerAnimated(this);
>>>>
>>>> But the problem is getCompoentForm() always return null.
>>>>
>>>> I then try to use form.registerAnimated(this), where the form is
>>>> the one which list is added to.
>>>>
>>>> After this registration, anmate() has been called endlessly while
>>>> it always returns true. However, the problem is paint() is only
>>>> called once and no successive calls at all, thus making animation
>>>> logic fail.
>>>>
>>>> Any clue for correcting this or is it a bug?
>>>>
>>>> Many 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

Qunhuan Mei

Hi again Shai and Chen,

Using LWUIT's methods available to the developer, I have so far failed
to see the feasibility of this list scrolling animation approach. But if
next code drop could cover this, that will be wonderful. One thing to
mention is: suppose we have a very long text, after the tail of the long
text is shown, the head of the text needs to be appearing, say with a
dozen or two pixels behind - I use font.height.

The other important issue I intended to flag you guys is, as a J2ME
developer, we would like to see this LWUIT is more capable than what
J2ME's competitors can do, e.g. FlashLite, at least from developers'
perspective (we tend to accept the fact that no graphic designers would
prefer J2ME/LWUIT to FlashLite in the near future).

LWUIT obviously made a huge leap forward already. But seems to me in
some aspect it is still not as capable as FlashLite. I remember during
my visit to the MobileWorldCongress2008, on Adobe's stand, I saw their
new list based UI, which involves vertical text scrolling (i.e. a list
cell in focus always come together with a rectangular area which does
the vertical text scrolling - it looks very cool). The list's UI
handling appears to be paramount to the user experience of a mobile
applications. I hope you guys have thought about all existing approaches
and even better if there is any innovative ones. I would also hope you
have got excellent designer(s) in your team.

Cheers,

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 17 June 2008 11:52
To: users@lwuit.dev.java.net
Subject: Re: Any way to know current list cell's y position?

Hi Qunhuan,
the same approach should apply here, this is a very common "ticker"
use case where the selected list element "scrolls".
We intend to add this functionality as part of the framework in a
future drop but right now its relatively easy to do...

It should work exactly as I illustrated in the previous email but if
you are having trouble I'll try to hack up a working example on the
blog but that might take me some time....

Thanks,
Shai.

> Hi Shai,
>
> I am SO sorry that I just realised that the working code is actually
> based on my "HARD CODED" cell position I did yesterday. So I am now
> back
> to the beginning :(.
>
> The current situation is (using "MyList extends List") :
>
> The paint method from List is looking after the drawing of the whole
> list, i.e. all the list cells, not one cell a time based on multiple
> paint calls. When there is no animation, the paint() will be called
> once. When animation is needed, the paint() needs to be called
> continuously to keep the FRAME going. There is no physical cell info
> available. (hasFocus() here is nothing to do with any specific cell
> but
> to the whole list).
>
> If the animation is something based on indexed images or alike, the
> animation can be achieved based on changing image reference before a
> frame is painted (i.e. changing frame data).
>
> However, my animation request is different, which is to scroll
> specific
> cell text horizontally (one pixel a time). It may also involve
> changing
> font for that specific cell. Using g.translate(...) does not work
> since
> at least it applies to the whole list, not to a single list cell.
>
> Do you still see an approach match here?
>
> Qunhuan
>
>
> -----Original Message-----
> From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
> Sent: 17 June 2008 10:44
> To: users@lwuit.dev.java.net
> Subject: RE: Any way to know current list cell's y position?
>
> Hi Shai,
>
> Forgive my silliness here - I was about to change my approach after
> failing to see the ideal result. But I forced myself to try once more
> after receiving your message since I think if two gurus are
> sticking to
> an approach, the problem must be on my side.
>
> ... Now, it is fully working!
>
> Thanks very much INDEED to both of you!
>
> Have a great day!
>
> Qunhuan
>
> -----Original Message-----
> From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
> Sent: 16 June 2008 20:12
> To: users@lwuit.dev.java.net
> Subject: Re: Any way to know current list cell's y position?
>
> Hi Qunhuan,
> what Chen was saying is this:
>
> When List.animate() returns true, its paint method will draw all
> visible renderer areas. Assuming we would provide you with such a
> feature it would "collide" with the lists drawing of the cell
> renderer... So even if you could calculate that location it just
> wouldn't work as you would want.
>
> The solution is very simple though, while you must implement
> List.animate() to perform the animation portion you can do the
> physical animation within MyRenderer.paint(Graphics). Such as:
>
> // within list
> public boolean animate() {
> // update timer
> // if timer elapsed
> if(timer > 500) {
> time = 0;
> ticker++;
> return true;
> }
> return false;
> }
>
>
> // within renderer
> public void paint(Graphics g) {
> // if this is the selected entry then I only want to animate
> that...
> if(hasFocus()) {
> // perform animation drawing e.g. ticker translation
> return;
> }
> // standard renderer code
> //...
> }
>
> Hope this is clear,
> Thanks,
> Shai.
>
>
>> Hi Chen,
>>
>> Thanks for your reply. But I am not very sure if I fully understand
>> your approach here. The problem I am facing is, for example, where
>> should be a list's 30th cell position (Y) on the screen, if I need
>> to draw an animation within the cell (e.g. a ticker).
>>
>> Within the paint() method of MyList, getX() and getY() always
>> returns the top left corner of the list, not the list cell's.
>> The list cell's Y position in focus is affected by FIXED_CENTER,
>> FIEXED_LEAD, ... etc and the logic how these actually works in
>> LWUIT. Manual work has to take into considerations of all these
>> factors.
>>
>> But the consideration of these factors has already been done in
>> LWUIT's unexposed part.
>>
>> Regards,
>>
>> qunhuan
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 16 June 2008 16:58
>> To: users@lwuit.dev.java.net
>> Subject: Re: Any way to know current list cell's y position?
>>
>> Hi Qunhuan,
>> You don't need to look for the animation position.
>> What you need to do is to update the animation state in the list
>> animation and to use the variables you changed in your list renderer.
>> For ex:
>> If you would like to implement a text ticker in the list, increase a
>> counter in the animate method and use the modified counter in the
>> renderer(for selected state), all the painting logic should be
>> placed in
>> the renderer.
>>
>> Regards,
>> Chen
>>
>>
>>> Hi,
>>>
>>> I have created a class of MyList which "extends List". For each
>>> list cell, I need to look after its drawing or animation.
>>> I was wondering if there is any way to know the Y position of
>>> current selected/focused list cell (I failed to find), or if there
>>> is any hidden method of such could be made available outside the
>>> LWUIT?
>>>
>>> To manually work out a cell's Y position is possible but would be
>>> a bit ugly.
>>>
>>> Could you help please?
>>>
>>> Qunhuan
>>>
>>> -----Original Message-----
>>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>>> Sent: 04 June 2008 17:30
>>> To: users@lwuit.dev.java.net
>>> Subject: Re: Is it a bug from the CellRenderer handling logic
>>>
>>> Hi Qunhuan,
>>> The List uses the Renderer to paint all elements therefore it is
>>> not a
>>> usual Component that has a parent or a state.
>>> Try the following to enable this feature:
>>> Extend the List Component and override the List animate method:
>>>
>>> class MyList extends List{
>>>
>>> public boolean animate(){
>>> boolean retVal = super.animate();
>>> //if the List is in the middle of an animation(usually when
>>> scrolling), don't interrupt
>>> if(retVal){
>>> return retVal;
>>> }
>>> //preform your animate code here...
>>> }
>>>
>>> }
>>>
>>> Then make sure the renderer uses the the variables you modified in
>>> the
>>> animate code above correctly.
>>> For ex:
>>> If you try to create a Ticker like functionality inside the List
>>> Renderer make sure only the selected item in the renderer uses the
>>> variables you modified above or else all cells will use the
>>> animation.
>>> Be aware that this approach might cause some performance penalty
>>> since
>>> the List iterate over all the visible elements every time animate
>>> returns true.
>>>
>>> Regards,
>>> Chen
>>>
>>>
>>>
>>>
>>> Qunhuan Mei wrote:
>>>
>>>> Greetings!
>>>>
>>>> After I managed to implement an animation handling logic for a
>>>> Label content, I am hoping to have my own cell renderer for a
>>>> List so that I can do some animation on any List's cell content
>>>> in focus. The List has been added to a Form in a usual way.
>>>>
>>>> The way I implemented my own cell render is also usual:
>>>>
>>>> public class CellRenderer extends DefaultListCellRenderer {
>>>> ......
>>>> public void paint(Graphics g){
>>>> ......
>>>> }
>>>> public boolean animate() {
>>>> return needsAnimation; //
>>>> }
>>>> }
>>>>
>>>>
>>>> Or (also tried)
>>>>
>>>> public class CellRenderer extends Label implements
>>>> ListCellRenderer, Animation {
>>>> ......
>>>> public void paint(Graphics g){
>>>> ......
>>>> }
>>>> public boolean animate() {
>>>> return needsAnimation; //
>>>> }
>>>> }
>>>>
>>>> I managed to paint the cell content in my own way statically,
>>>> that is, without animation.
>>>>
>>>> However, I failed in painting in animated way.
>>>>
>>>> What I did was inside paint(Graphics g) method, I call
>>>> getComponentForm().registerAnimated(this);
>>>>
>>>> But the problem is getCompoentForm() always return null.
>>>>
>>>> I then try to use form.registerAnimated(this), where the form is
>>>> the one which list is added to.
>>>>
>>>> After this registration, anmate() has been called endlessly while
>>>> it always returns true. However, the problem is paint() is only
>>>> called once and no successive calls at all, thus making animation
>>>> logic fail.
>>>>
>>>> Any clue for correcting this or is it a bug?
>>>>
>>>> Many 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 there,

There seems to be a positioning issue for ComboBox.

I have created a "registration" form which has a few ComboBox(es).

When a middle page ComboBox is in focus, the popup of the combobox looks
alright. However when a bottom page combobix is in focus, most part of
the full sized popup of the combobox goes outside of the screen.
Although there is a scrollbar attached to a single line which still
manages to be visible, making it "logically" sound, I think it lost the
sense of good user experience.

Personally I assume a good user experience, related to the positioning
of a Combobox, should always have a logic to decide where to be
positioned, rather than always in the place below. If can be displayed
fully below then go ahead. If not then should be displayed above, so
that user could always have a full sized view of the combobox. If the
screen is too small, then the scroll bar could get involved.

Just a suggestion

Thanks,

Qunhuan

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

chen

Hi Qunhuan,
Comboxes actually preform this logic, if the combo doesn't have enough
space it will popup the list upwards.(your combo is probably not down
enough).

Regards,
Chen

Qunhuan Mei wrote:
> Hi there,
>
> There seems to be a positioning issue for ComboBox.
>
> I have created a "registration" form which has a few ComboBox(es).
>
> When a middle page ComboBox is in focus, the popup of the combobox looks
> alright. However when a bottom page combobix is in focus, most part of
> the full sized popup of the combobox goes outside of the screen.
> Although there is a scrollbar attached to a single line which still
> manages to be visible, making it "logically" sound, I think it lost the
> sense of good user experience.
>
> Personally I assume a good user experience, related to the positioning
> of a Combobox, should always have a logic to decide where to be
> positioned, rather than always in the place below. If can be displayed
> fully below then go ahead. If not then should be displayed above, so
> that user could always have a full sized view of the combobox. If the
> screen is too small, then the scroll bar could get involved.
>
> Just a suggestion
>
> 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 Chen,

You are right. If the combox is right at the bottom (e.g. "Choose
Country" shown below), then the combo box is displayed correctly.
Otherwise, it shows as below:

Image 1:

Image 2:

Seems to me there might be logic flaw.

Thanks,

qunhuan

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 17 June 2008 14:40
To: users@lwuit.dev.java.net
Subject: Re: A positioning issue for ComboBox.

Hi Qunhuan,

Comboxes actually preform this logic, if the combo doesn't have enough

space it will popup the list upwards.(your combo is probably not down

enough).

Regards,

Chen

Qunhuan Mei wrote:

> Hi there,

>

> There seems to be a positioning issue for ComboBox.

>

> I have created a "registration" form which has a few ComboBox(es).

>

> When a middle page ComboBox is in focus, the popup of the combobox
looks

> alright. However when a bottom page combobix is in focus, most part of

> the full sized popup of the combobox goes outside of the screen.

> Although there is a scrollbar attached to a single line which still

> manages to be visible, making it "logically" sound, I think it lost
the

> sense of good user experience.

>

> Personally I assume a good user experience, related to the positioning

> of a Combobox, should always have a logic to decide where to be

> positioned, rather than always in the place below. If can be displayed

> fully below then go ahead. If not then should be displayed above, so

> that user could always have a full sized view of the combobox. If the

> screen is too small, then the scroll bar could get involved.

>

> Just a suggestion

>

> 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

[att1.html]
[image001.png]
[image002.png]

chen

Hi,
The popup opens up if no room for 2 items minos margins, paddings, looks
like we need to extend it to 3 items.

Thanks,
Chen

Qunhuan Mei wrote:
>
> Hi Chen,
>
> You are right. If the combox is right at the bottom (e.g. “Choose
> Country” shown below), then the combo box is displayed correctly.
> Otherwise, it shows as below:
>
> Image 1:
>
> Image 2:
>
> Seems to me there might be logic flaw.
>
> Thanks,
>
> qunhuan
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 17 June 2008 14:40
> To: users@lwuit.dev.java.net
> Subject: Re: A positioning issue for ComboBox.
>
> Hi Qunhuan,
>
> Comboxes actually preform this logic, if the combo doesn't have enough
>
> space it will popup the list upwards.(your combo is probably not down
>
> enough).
>
> Regards,
>
> Chen
>
> Qunhuan Mei wrote:
>
> > Hi there,
>
> >
>
> > There seems to be a positioning issue for ComboBox.
>
> >
>
> > I have created a "registration" form which has a few ComboBox(es).
>
> >
>
> > When a middle page ComboBox is in focus, the popup of the combobox looks
>
> > alright. However when a bottom page combobix is in focus, most part of
>
> > the full sized popup of the combobox goes outside of the screen.
>
> > Although there is a scrollbar attached to a single line which still
>
> > manages to be visible, making it "logically" sound, I think it lost the
>
> > sense of good user experience.
>
> >
>
> > Personally I assume a good user experience, related to the positioning
>
> > of a Combobox, should always have a logic to decide where to be
>
> > positioned, rather than always in the place below. If can be displayed
>
> > fully below then go ahead. If not then should be displayed above, so
>
> > that user could always have a full sized view of the combobox. If the
>
> > screen is too small, then the scroll bar could get involved.
>
> >
>
> > Just a suggestion
>
> >
>
> > 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

I suppose it might be better not to have any fixed number (the most
popular phones are getting "higher") but relying the logic on the actual
combobox's size and available space etc.

Please also note there is the colour difference in the images. It would
be helpful if we know what is the transparency used for the colour in
the 2nd image.

Thanks, Q

Image 1:

Image 2:

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 17 June 2008 15:08
To: users@lwuit.dev.java.net
Subject: Re: A positioning issue for ComboBox.

Hi,

The popup opens up if no room for 2 items minos margins, paddings, looks

like we need to extend it to 3 items.

Thanks,

Chen

Qunhuan Mei wrote:

>

> Hi Chen,

>

> You are right. If the combox is right at the bottom (e.g. "Choose

> Country" shown below), then the combo box is displayed correctly.

> Otherwise, it shows as below:

>

> Image 1:

>

> Image 2:

>

> Seems to me there might be logic flaw.

>

> Thanks,

>

> qunhuan

>

> -----Original Message-----

> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]

> Sent: 17 June 2008 14:40

> To: users@lwuit.dev.java.net

> Subject: Re: A positioning issue for ComboBox.

>

> Hi Qunhuan,

>

> Comboxes actually preform this logic, if the combo doesn't have enough

>

> space it will popup the list upwards.(your combo is probably not down

>

> enough).

>

> Regards,

>

> Chen

>

> Qunhuan Mei wrote:

>

> > Hi there,

>

> >

>

> > There seems to be a positioning issue for ComboBox.

>

> >

>

> > I have created a "registration" form which has a few ComboBox(es).

>

> >

>

> > When a middle page ComboBox is in focus, the popup of the combobox
looks

>

> > alright. However when a bottom page combobix is in focus, most part
of

>

> > the full sized popup of the combobox goes outside of the screen.

>

> > Although there is a scrollbar attached to a single line which still

>

> > manages to be visible, making it "logically" sound, I think it lost
the

>

> > sense of good user experience.

>

> >

>

> > Personally I assume a good user experience, related to the
positioning

>

> > of a Combobox, should always have a logic to decide where to be

>

> > positioned, rather than always in the place below. If can be
displayed

>

> > fully below then go ahead. If not then should be displayed above, so

>

> > that user could always have a full sized view of the combobox. If
the

>

> > screen is too small, then the scroll bar could get involved.

>

> >

>

> > Just a suggestion

>

> >

>

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

[att1.html]
[image001.png]
[image002.png]

danko
Offline
Joined: 2008-07-18
Points: 0

Hi there,
I have a similar problem.

In a small form the combobox works fine.
http://666kb.com/i/b0mib5a9bwr6qwp77.png

Similar combobox in a bigger form position at the bottom of the screen but not at the bottom in the form
closed: http://666kb.com/i/b0micpbxppe46vvyr.png
opened: http://666kb.com/i/b0migbe00p5f0mglv.png
opened when it is positioned in the middle of the screen: http://666kb.com/i/b0migv739ltfxhw2b.png
Why is the comboboxfield always covered with open list?

crazy behavior:
I go from top to down in the form open at the bottom position the comobox and select an element that is on the end of the list. Then I focus the next element(button) and go back to the combobox and open it again. After that I get this http://666kb.com/i/b0minxn8s4rmngqkz.png :-D

How I get this http://666kb.com/i/b0mikrcqxi6dqvr83.png I do not know. It is very seldom. Additional to that before the selected item is not shown.

If the combobox is position near to the buttom edge http://666kb.com/i/b0mivdtc5x8ekupoz.png it opens on the comboboxfield. http://666kb.com/i/b0mixvyqeet4st1n7.png
I would prefer to open the list above or below the field.

I do not know why but now it opens on any position of the comboboxfield the list always on it. http://666kb.com/i/b0mj6qgqj7wkbm103.png

Well, I do not get it again but here the screen http://666kb.com/i/b0mj97gat38c8ebgz.png
It opens the list without to show the selected line.

I don't know why it lives its own life.
Thanks a lot for reading, watching and answering.
danko

Shai Almog

Hi,
> Similar combobox in a bigger form position at the bottom of the
> screen but not at the bottom in the form
> closed: http://666kb.com/i/b0micpbxppe46vvyr.png
> opened: http://666kb.com/i/b0migbe00p5f0mglv.png
> opened when it is positioned in the middle of the screen: http://
> 666kb.com/i/b0migv739ltfxhw2b.png

The condition for opening the combo box upwards is somewhat complex
since it needs to work for very small screen sizes and for large
renderers... So the logic here might be flawed we will go over this.

> Why is the comboboxfield always covered with open list?

We consider this to be a better approach than opening bellow/above
since the list is essentially replacing the combo box as the input
method. The same is not true for mouse based UI's but for key
navigation only this is pretty much the case.

> crazy behavior:
> I go from top to down in the form open at the bottom position the
> comobox and select an element that is on the end of the list. Then
> I focus the next element(button) and go back to the combobox and
> open it again. After that I get this http://666kb.com/i/
> b0minxn8s4rmngqkz.png :-D

This is a result of my scroll selection to visible change, previously
the behavior was worse where the selection just wasn't visible at all
until you start navigating so this is an improvement...

> How I get this http://666kb.com/i/b0mikrcqxi6dqvr83.png I do not
> know. It is very seldom. Additional to that before the selected
> item is not shown.

If you can give me instructions to reproduce it that might be an
issue. I think it would be caused by selecting an element at the end,
followed by selection a null element.

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

[att1.html]

danko
Offline
Joined: 2008-07-18
Points: 0

Hi,

> > How I get this
> http://666kb.com/i/b0mikrcqxi6dqvr83.png I do not
> > know. It is very seldom. Additional to that before
> the selected
> > item is not shown.
>
> If you can give me instructions to reproduce it that
> might be an
> issue. I think it would be caused by selecting an
> element at the end,
> followed by selection a null element.
Sorry, I do not get it again. Yesterday I got it twice while writing the post. Today I playing for near an hour without success.
What do you mean with "> followed by selection a null element."? I do/did not add null or empty strings "".
a printout of the strings before addItem:
add: Betriebsfahrt
add: ChancePlus
add: Freizeit/Turnus
add: Privat
add: Therapien

Another question:
What is the best way to remove all items?
My way:
while (Combobox.size() > 0)
{
Combobox.getModel().removeItem(0);
}

to use Combobox = new Combobox(); is not the way to success because not default style definition will be lost.

Thanks,
danko

Shai Almog

>>
> Sorry, I do not get it again. Yesterday I got it twice while
> writing the post. Today I playing for near an hour without success.
> What do you mean with "> followed by selection a null element."? I
> do/did not add null or empty strings "".
> a printout of the strings before addItem:
> add: Betriebsfahrt
> add: ChancePlus
> add: Freizeit/Turnus
> add: Privat
> add: Therapien

No idea, this was just an assumption based on my familiarity with our
code.

> Another question:
> What is the best way to remove all items?
> My way:
> while (Combobox.size() > 0)
> {
> Combobox.getModel().removeItem(0);
> }
>
> to use Combobox = new Combobox(); is not the way to success because
> not default style definition will be lost.

This depends on the number of elements... DefaultListModel just does
this for removeAll() which works well for a small size:
while(getSize() > 0) {
removeItem(0);
}

If you have a large combo box you will probably be better off by just:
combo.setModel(new DefaultListModel());

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

[att1.html]

Qunhuan Mei

Hi Chen,

Thanks for your reply. But I am not very sure if I fully understand your approach here. The problem I am facing is, for example, where should be a list's 30th cell position (Y) on the screen, if I need to draw an animation within the cell (e.g. a ticker).

Within the paint() method of MyList, getX() and getY() always returns the top left corner of the list, not the list cell's.
The list cell's Y position in focus is affected by FIXED_CENTER, FIEXED_LEAD, ... etc and the logic how these actually works in LWUIT. Manual work has to take into considerations of all these factors.

But the consideration of these factors has already been done in LWUIT's unexposed part.

Regards,

qunhuan

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 16 June 2008 16:58
To: users@lwuit.dev.java.net
Subject: Re: Any way to know current list cell’s y position?

Hi Qunhuan,
You don't need to look for the animation position.
What you need to do is to update the animation state in the list
animation and to use the variables you changed in your list renderer.
For ex:
If you would like to implement a text ticker in the list, increase a
counter in the animate method and use the modified counter in the
renderer(for selected state), all the painting logic should be placed in
the renderer.

Regards,
Chen

> Hi,
>
> I have created a class of MyList which “extends List”. For each list cell, I need to look after its drawing or animation.
> I was wondering if there is any way to know the Y position of current selected/focused list cell (I failed to find), or if there is any hidden method of such could be made available outside the LWUIT?
>
> To manually work out a cell’s Y position is possible but would be a bit ugly.
>
> Could you help please?
>
> Qunhuan
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 04 June 2008 17:30
> To: users@lwuit.dev.java.net
> Subject: Re: Is it a bug from the CellRenderer handling logic
>
> Hi Qunhuan,
> The List uses the Renderer to paint all elements therefore it is not a
> usual Component that has a parent or a state.
> Try the following to enable this feature:
> Extend the List Component and override the List animate method:
>
> class MyList extends List{
>
> public boolean animate(){
> boolean retVal = super.animate();
> //if the List is in the middle of an animation(usually when
> scrolling), don't interrupt
> if(retVal){
> return retVal;
> }
> //preform your animate code here...
> }
>
> }
>
> Then make sure the renderer uses the the variables you modified in the
> animate code above correctly.
> For ex:
> If you try to create a Ticker like functionality inside the List
> Renderer make sure only the selected item in the renderer uses the
> variables you modified above or else all cells will use the animation.
> Be aware that this approach might cause some performance penalty since
> the List iterate over all the visible elements every time animate
> returns true.
>
> Regards,
> Chen
>
>
>
>
> Qunhuan Mei wrote:
>
>> Greetings!
>>
>> After I managed to implement an animation handling logic for a Label content, I am hoping to have my own cell renderer for a List so that I can do some animation on any List’s cell content in focus. The List has been added to a Form in a usual way.
>>
>> The way I implemented my own cell render is also usual:
>>
>> public class CellRenderer extends DefaultListCellRenderer {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>>
>> Or (also tried)
>>
>> public class CellRenderer extends Label implements ListCellRenderer, Animation {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>> I managed to paint the cell content in my own way statically, that is, without animation.
>>
>> However, I failed in painting in animated way.
>>
>> What I did was inside paint(Graphics g) method, I call getComponentForm().registerAnimated(this);
>>
>> But the problem is getCompoentForm() always return null.
>>
>> I then try to use form.registerAnimated(this), where the form is the one which list is added to.
>>
>> After this registration, anmate() has been called endlessly while it always returns true. However, the problem is paint() is only called once and no successive calls at all, thus making animation logic fail.
>>
>> Any clue for correcting this or is it a bug?
>>
>> Many 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

Shai Almog

Hi Qunhuan,
what Chen was saying is this:

When List.animate() returns true, its paint method will draw all
visible renderer areas. Assuming we would provide you with such a
feature it would "collide" with the lists drawing of the cell
renderer... So even if you could calculate that location it just
wouldn't work as you would want.

The solution is very simple though, while you must implement
List.animate() to perform the animation portion you can do the
physical animation within MyRenderer.paint(Graphics). Such as:

// within list
public boolean animate() {
// update timer
// if timer elapsed
if(timer > 500) {
time = 0;
ticker++;
return true;
}
return false;
}

// within renderer
public void paint(Graphics g) {
// if this is the selected entry then I only want to animate that...
if(hasFocus()) {
// perform animation drawing e.g. ticker translation
return;
}
// standard renderer code
//...
}

Hope this is clear,
Thanks,
Shai.

> Hi Chen,
>
> Thanks for your reply. But I am not very sure if I fully understand
> your approach here. The problem I am facing is, for example, where
> should be a list's 30th cell position (Y) on the screen, if I need
> to draw an animation within the cell (e.g. a ticker).
>
> Within the paint() method of MyList, getX() and getY() always
> returns the top left corner of the list, not the list cell's.
> The list cell's Y position in focus is affected by FIXED_CENTER,
> FIEXED_LEAD, ... etc and the logic how these actually works in
> LWUIT. Manual work has to take into considerations of all these
> factors.
>
> But the consideration of these factors has already been done in
> LWUIT's unexposed part.
>
> Regards,
>
> qunhuan
>
>
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 16 June 2008 16:58
> To: users@lwuit.dev.java.net
> Subject: Re: Any way to know current list cell’s y position?
>
> Hi Qunhuan,
> You don't need to look for the animation position.
> What you need to do is to update the animation state in the list
> animation and to use the variables you changed in your list renderer.
> For ex:
> If you would like to implement a text ticker in the list, increase a
> counter in the animate method and use the modified counter in the
> renderer(for selected state), all the painting logic should be
> placed in
> the renderer.
>
> Regards,
> Chen
>
>
>> Hi,
>>
>> I have created a class of MyList which “extends List”. For each
>> list cell, I need to look after its drawing or animation.
>> I was wondering if there is any way to know the Y position of
>> current selected/focused list cell (I failed to find), or if there
>> is any hidden method of such could be made available outside the
>> LWUIT?
>>
>> To manually work out a cell’s Y position is possible but would be
>> a bit ugly.
>>
>> Could you help please?
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 04 June 2008 17:30
>> To: users@lwuit.dev.java.net
>> Subject: Re: Is it a bug from the CellRenderer handling logic
>>
>> Hi Qunhuan,
>> The List uses the Renderer to paint all elements therefore it is
>> not a
>> usual Component that has a parent or a state.
>> Try the following to enable this feature:
>> Extend the List Component and override the List animate method:
>>
>> class MyList extends List{
>>
>> public boolean animate(){
>> boolean retVal = super.animate();
>> //if the List is in the middle of an animation(usually when
>> scrolling), don't interrupt
>> if(retVal){
>> return retVal;
>> }
>> //preform your animate code here...
>> }
>>
>> }
>>
>> Then make sure the renderer uses the the variables you modified in
>> the
>> animate code above correctly.
>> For ex:
>> If you try to create a Ticker like functionality inside the List
>> Renderer make sure only the selected item in the renderer uses the
>> variables you modified above or else all cells will use the
>> animation.
>> Be aware that this approach might cause some performance penalty
>> since
>> the List iterate over all the visible elements every time animate
>> returns true.
>>
>> Regards,
>> Chen
>>
>>
>>
>>
>> Qunhuan Mei wrote:
>>
>>> Greetings!
>>>
>>> After I managed to implement an animation handling logic for a
>>> Label content, I am hoping to have my own cell renderer for a
>>> List so that I can do some animation on any List’s cell content
>>> in focus. The List has been added to a Form in a usual way.
>>>
>>> The way I implemented my own cell render is also usual:
>>>
>>> public class CellRenderer extends DefaultListCellRenderer {
>>> ......
>>> public void paint(Graphics g){
>>> ......
>>> }
>>> public boolean animate() {
>>> return needsAnimation; //
>>> }
>>> }
>>>
>>>
>>> Or (also tried)
>>>
>>> public class CellRenderer extends Label implements
>>> ListCellRenderer, Animation {
>>> ......
>>> public void paint(Graphics g){
>>> ......
>>> }
>>> public boolean animate() {
>>> return needsAnimation; //
>>> }
>>> }
>>>
>>> I managed to paint the cell content in my own way statically,
>>> that is, without animation.
>>>
>>> However, I failed in painting in animated way.
>>>
>>> What I did was inside paint(Graphics g) method, I call
>>> getComponentForm().registerAnimated(this);
>>>
>>> But the problem is getCompoentForm() always return null.
>>>
>>> I then try to use form.registerAnimated(this), where the form is
>>> the one which list is added to.
>>>
>>> After this registration, anmate() has been called endlessly while
>>> it always returns true. However, the problem is paint() is only
>>> called once and no successive calls at all, thus making animation
>>> logic fail.
>>>
>>> Any clue for correcting this or is it a bug?
>>>
>>> Many 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

Hi Shai,

Forgive my silliness here - I was about to change my approach after
failing to see the ideal result. But I forced myself to try once more
after receiving your message since I think if two gurus are sticking to
an approach, the problem must be on my side.

... Now, it is fully working!

Thanks very much INDEED to both of you!

Have a great day!

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 16 June 2008 20:12
To: users@lwuit.dev.java.net
Subject: Re: Any way to know current list cell's y position?

Hi Qunhuan,
what Chen was saying is this:

When List.animate() returns true, its paint method will draw all
visible renderer areas. Assuming we would provide you with such a
feature it would "collide" with the lists drawing of the cell
renderer... So even if you could calculate that location it just
wouldn't work as you would want.

The solution is very simple though, while you must implement
List.animate() to perform the animation portion you can do the
physical animation within MyRenderer.paint(Graphics). Such as:

// within list
public boolean animate() {
// update timer
// if timer elapsed
if(timer > 500) {
time = 0;
ticker++;
return true;
}
return false;
}

// within renderer
public void paint(Graphics g) {
// if this is the selected entry then I only want to animate
that...
if(hasFocus()) {
// perform animation drawing e.g. ticker translation
return;
}
// standard renderer code
//...
}

Hope this is clear,
Thanks,
Shai.

> Hi Chen,
>
> Thanks for your reply. But I am not very sure if I fully understand
> your approach here. The problem I am facing is, for example, where
> should be a list's 30th cell position (Y) on the screen, if I need
> to draw an animation within the cell (e.g. a ticker).
>
> Within the paint() method of MyList, getX() and getY() always
> returns the top left corner of the list, not the list cell's.
> The list cell's Y position in focus is affected by FIXED_CENTER,
> FIEXED_LEAD, ... etc and the logic how these actually works in
> LWUIT. Manual work has to take into considerations of all these
> factors.
>
> But the consideration of these factors has already been done in
> LWUIT's unexposed part.
>
> Regards,
>
> qunhuan
>
>
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 16 June 2008 16:58
> To: users@lwuit.dev.java.net
> Subject: Re: Any way to know current list cell's y position?
>
> Hi Qunhuan,
> You don't need to look for the animation position.
> What you need to do is to update the animation state in the list
> animation and to use the variables you changed in your list renderer.
> For ex:
> If you would like to implement a text ticker in the list, increase a
> counter in the animate method and use the modified counter in the
> renderer(for selected state), all the painting logic should be
> placed in
> the renderer.
>
> Regards,
> Chen
>
>
>> Hi,
>>
>> I have created a class of MyList which "extends List". For each
>> list cell, I need to look after its drawing or animation.
>> I was wondering if there is any way to know the Y position of
>> current selected/focused list cell (I failed to find), or if there
>> is any hidden method of such could be made available outside the
>> LWUIT?
>>
>> To manually work out a cell's Y position is possible but would be
>> a bit ugly.
>>
>> Could you help please?
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 04 June 2008 17:30
>> To: users@lwuit.dev.java.net
>> Subject: Re: Is it a bug from the CellRenderer handling logic
>>
>> Hi Qunhuan,
>> The List uses the Renderer to paint all elements therefore it is
>> not a
>> usual Component that has a parent or a state.
>> Try the following to enable this feature:
>> Extend the List Component and override the List animate method:
>>
>> class MyList extends List{
>>
>> public boolean animate(){
>> boolean retVal = super.animate();
>> //if the List is in the middle of an animation(usually when
>> scrolling), don't interrupt
>> if(retVal){
>> return retVal;
>> }
>> //preform your animate code here...
>> }
>>
>> }
>>
>> Then make sure the renderer uses the the variables you modified in
>> the
>> animate code above correctly.
>> For ex:
>> If you try to create a Ticker like functionality inside the List
>> Renderer make sure only the selected item in the renderer uses the
>> variables you modified above or else all cells will use the
>> animation.
>> Be aware that this approach might cause some performance penalty
>> since
>> the List iterate over all the visible elements every time animate
>> returns true.
>>
>> Regards,
>> Chen
>>
>>
>>
>>
>> Qunhuan Mei wrote:
>>
>>> Greetings!
>>>
>>> After I managed to implement an animation handling logic for a
>>> Label content, I am hoping to have my own cell renderer for a
>>> List so that I can do some animation on any List's cell content
>>> in focus. The List has been added to a Form in a usual way.
>>>
>>> The way I implemented my own cell render is also usual:
>>>
>>> public class CellRenderer extends DefaultListCellRenderer {
>>> ......
>>> public void paint(Graphics g){
>>> ......
>>> }
>>> public boolean animate() {
>>> return needsAnimation; //
>>> }
>>> }
>>>
>>>
>>> Or (also tried)
>>>
>>> public class CellRenderer extends Label implements
>>> ListCellRenderer, Animation {
>>> ......
>>> public void paint(Graphics g){
>>> ......
>>> }
>>> public boolean animate() {
>>> return needsAnimation; //
>>> }
>>> }
>>>
>>> I managed to paint the cell content in my own way statically,
>>> that is, without animation.
>>>
>>> However, I failed in painting in animated way.
>>>
>>> What I did was inside paint(Graphics g) method, I call
>>> getComponentForm().registerAnimated(this);
>>>
>>> But the problem is getCompoentForm() always return null.
>>>
>>> I then try to use form.registerAnimated(this), where the form is
>>> the one which list is added to.
>>>
>>> After this registration, anmate() has been called endlessly while
>>> it always returns true. However, the problem is paint() is only
>>> called once and no successive calls at all, thus making animation
>>> logic fail.
>>>
>>> Any clue for correcting this or is it a bug?
>>>
>>> Many 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

Qunhuan Mei

Hi Shai,

I am SO sorry that I just realised that the working code is actually
based on my "HARD CODED" cell position I did yesterday. So I am now back
to the beginning :(.

The current situation is (using "MyList extends List") :

The paint method from List is looking after the drawing of the whole
list, i.e. all the list cells, not one cell a time based on multiple
paint calls. When there is no animation, the paint() will be called
once. When animation is needed, the paint() needs to be called
continuously to keep the FRAME going. There is no physical cell info
available. (hasFocus() here is nothing to do with any specific cell but
to the whole list).

If the animation is something based on indexed images or alike, the
animation can be achieved based on changing image reference before a
frame is painted (i.e. changing frame data).

However, my animation request is different, which is to scroll specific
cell text horizontally (one pixel a time). It may also involve changing
font for that specific cell. Using g.translate(...) does not work since
at least it applies to the whole list, not to a single list cell.

Do you still see an approach match here?

Qunhuan

-----Original Message-----
From: Qunhuan Mei [mailto:qunhuan.mei@mfuse.com]
Sent: 17 June 2008 10:44
To: users@lwuit.dev.java.net
Subject: RE: Any way to know current list cell's y position?

Hi Shai,

Forgive my silliness here - I was about to change my approach after
failing to see the ideal result. But I forced myself to try once more
after receiving your message since I think if two gurus are sticking to
an approach, the problem must be on my side.

... Now, it is fully working!

Thanks very much INDEED to both of you!

Have a great day!

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 16 June 2008 20:12
To: users@lwuit.dev.java.net
Subject: Re: Any way to know current list cell's y position?

Hi Qunhuan,
what Chen was saying is this:

When List.animate() returns true, its paint method will draw all
visible renderer areas. Assuming we would provide you with such a
feature it would "collide" with the lists drawing of the cell
renderer... So even if you could calculate that location it just
wouldn't work as you would want.

The solution is very simple though, while you must implement
List.animate() to perform the animation portion you can do the
physical animation within MyRenderer.paint(Graphics). Such as:

// within list
public boolean animate() {
// update timer
// if timer elapsed
if(timer > 500) {
time = 0;
ticker++;
return true;
}
return false;
}

// within renderer
public void paint(Graphics g) {
// if this is the selected entry then I only want to animate
that...
if(hasFocus()) {
// perform animation drawing e.g. ticker translation
return;
}
// standard renderer code
//...
}

Hope this is clear,
Thanks,
Shai.

> Hi Chen,
>
> Thanks for your reply. But I am not very sure if I fully understand
> your approach here. The problem I am facing is, for example, where
> should be a list's 30th cell position (Y) on the screen, if I need
> to draw an animation within the cell (e.g. a ticker).
>
> Within the paint() method of MyList, getX() and getY() always
> returns the top left corner of the list, not the list cell's.
> The list cell's Y position in focus is affected by FIXED_CENTER,
> FIEXED_LEAD, ... etc and the logic how these actually works in
> LWUIT. Manual work has to take into considerations of all these
> factors.
>
> But the consideration of these factors has already been done in
> LWUIT's unexposed part.
>
> Regards,
>
> qunhuan
>
>
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 16 June 2008 16:58
> To: users@lwuit.dev.java.net
> Subject: Re: Any way to know current list cell's y position?
>
> Hi Qunhuan,
> You don't need to look for the animation position.
> What you need to do is to update the animation state in the list
> animation and to use the variables you changed in your list renderer.
> For ex:
> If you would like to implement a text ticker in the list, increase a
> counter in the animate method and use the modified counter in the
> renderer(for selected state), all the painting logic should be
> placed in
> the renderer.
>
> Regards,
> Chen
>
>
>> Hi,
>>
>> I have created a class of MyList which "extends List". For each
>> list cell, I need to look after its drawing or animation.
>> I was wondering if there is any way to know the Y position of
>> current selected/focused list cell (I failed to find), or if there
>> is any hidden method of such could be made available outside the
>> LWUIT?
>>
>> To manually work out a cell's Y position is possible but would be
>> a bit ugly.
>>
>> Could you help please?
>>
>> Qunhuan
>>
>> -----Original Message-----
>> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
>> Sent: 04 June 2008 17:30
>> To: users@lwuit.dev.java.net
>> Subject: Re: Is it a bug from the CellRenderer handling logic
>>
>> Hi Qunhuan,
>> The List uses the Renderer to paint all elements therefore it is
>> not a
>> usual Component that has a parent or a state.
>> Try the following to enable this feature:
>> Extend the List Component and override the List animate method:
>>
>> class MyList extends List{
>>
>> public boolean animate(){
>> boolean retVal = super.animate();
>> //if the List is in the middle of an animation(usually when
>> scrolling), don't interrupt
>> if(retVal){
>> return retVal;
>> }
>> //preform your animate code here...
>> }
>>
>> }
>>
>> Then make sure the renderer uses the the variables you modified in
>> the
>> animate code above correctly.
>> For ex:
>> If you try to create a Ticker like functionality inside the List
>> Renderer make sure only the selected item in the renderer uses the
>> variables you modified above or else all cells will use the
>> animation.
>> Be aware that this approach might cause some performance penalty
>> since
>> the List iterate over all the visible elements every time animate
>> returns true.
>>
>> Regards,
>> Chen
>>
>>
>>
>>
>> Qunhuan Mei wrote:
>>
>>> Greetings!
>>>
>>> After I managed to implement an animation handling logic for a
>>> Label content, I am hoping to have my own cell renderer for a
>>> List so that I can do some animation on any List's cell content
>>> in focus. The List has been added to a Form in a usual way.
>>>
>>> The way I implemented my own cell render is also usual:
>>>
>>> public class CellRenderer extends DefaultListCellRenderer {
>>> ......
>>> public void paint(Graphics g){
>>> ......
>>> }
>>> public boolean animate() {
>>> return needsAnimation; //
>>> }
>>> }
>>>
>>>
>>> Or (also tried)
>>>
>>> public class CellRenderer extends Label implements
>>> ListCellRenderer, Animation {
>>> ......
>>> public void paint(Graphics g){
>>> ......
>>> }
>>> public boolean animate() {
>>> return needsAnimation; //
>>> }
>>> }
>>>
>>> I managed to paint the cell content in my own way statically,
>>> that is, without animation.
>>>
>>> However, I failed in painting in animated way.
>>>
>>> What I did was inside paint(Graphics g) method, I call
>>> getComponentForm().registerAnimated(this);
>>>
>>> But the problem is getCompoentForm() always return null.
>>>
>>> I then try to use form.registerAnimated(this), where the form is
>>> the one which list is added to.
>>>
>>> After this registration, anmate() has been called endlessly while
>>> it always returns true. However, the problem is paint() is only
>>> called once and no successive calls at all, thus making animation
>>> logic fail.
>>>
>>> Any clue for correcting this or is it a bug?
>>>
>>> Many 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 LWUIT team,

The in-place text editor, TextField, is one significant help in
improving J2ME based app's user experience.

It seems to me currently the TextField.NUMERIC constraint is not working
yet. i.e.

For the following code:

TextField phoneNumberTextField = new TextField("");

phoneNumberTextField.setConstraint(TextField.NUMERIC);

The actual input on emulator will still accept usual in place text
editing, rather than number only editing.

Just to flag you this issue.

Thanks,

Qunhuan

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

chen

Hi Qunhuan,
The TextField was in early preview in the java.net version.
We are still working on this widget and it will be improved for the next
version.

Thanks,
Chen

Qunhuan Mei wrote:
> Hi LWUIT team,
>
> The in-place text editor, TextField, is one significant help in
> improving J2ME based app's user experience.
>
> It seems to me currently the TextField.NUMERIC constraint is not working
> yet. i.e.
>
> For the following code:
>
> TextField phoneNumberTextField = new TextField("");
>
> phoneNumberTextField.setConstraint(TextField.NUMERIC);
>
> The actual input on emulator will still accept usual in place text
> editing, rather than number only editing.
>
> Just to flag you this issue.
>
> 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,

I have created a class of MyList which “extends List”. For each list cell, I need to look after its drawing or animation.
I was wondering if there is any way to know the Y position of current selected/focused list cell (I failed to find), or if there is any hidden method of such could be made available outside the LWUIT?

To manually work out a cell’s Y position is possible but would be a bit ugly.

Could you help please?

Qunhuan

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 04 June 2008 17:30
To: users@lwuit.dev.java.net
Subject: Re: Is it a bug from the CellRenderer handling logic

Hi Qunhuan,
The List uses the Renderer to paint all elements therefore it is not a
usual Component that has a parent or a state.
Try the following to enable this feature:
Extend the List Component and override the List animate method:

class MyList extends List{

public boolean animate(){
boolean retVal = super.animate();
//if the List is in the middle of an animation(usually when
scrolling), don't interrupt
if(retVal){
return retVal;
}
//preform your animate code here...
}

}

Then make sure the renderer uses the the variables you modified in the
animate code above correctly.
For ex:
If you try to create a Ticker like functionality inside the List
Renderer make sure only the selected item in the renderer uses the
variables you modified above or else all cells will use the animation.
Be aware that this approach might cause some performance penalty since
the List iterate over all the visible elements every time animate
returns true.

Regards,
Chen

Qunhuan Mei wrote:
> Greetings!
>
> After I managed to implement an animation handling logic for a Label content, I am hoping to have my own cell renderer for a List so that I can do some animation on any List’s cell content in focus. The List has been added to a Form in a usual way.
>
> The way I implemented my own cell render is also usual:
>
> public class CellRenderer extends DefaultListCellRenderer {
> ......
> public void paint(Graphics g){
> ......
> }
> public boolean animate() {
> return needsAnimation; //
> }
> }
>
>
> Or (also tried)
>
> public class CellRenderer extends Label implements ListCellRenderer, Animation {
> ......
> public void paint(Graphics g){
> ......
> }
> public boolean animate() {
> return needsAnimation; //
> }
> }
>
> I managed to paint the cell content in my own way statically, that is, without animation.
>
> However, I failed in painting in animated way.
>
> What I did was inside paint(Graphics g) method, I call getComponentForm().registerAnimated(this);
>
> But the problem is getCompoentForm() always return null.
>
> I then try to use form.registerAnimated(this), where the form is the one which list is added to.
>
> After this registration, anmate() has been called endlessly while it always returns true. However, the problem is paint() is only called once and no successive calls at all, thus making animation logic fail.
>
> Any clue for correcting this or is it a bug?
>
> Many thanks,
>
> Qunhuan
>

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

chen

Hi Qunhuan,
You don't need to look for the animation position.
What you need to do is to update the animation state in the list
animation and to use the variables you changed in your list renderer.
For ex:
If you would like to implement a text ticker in the list, increase a
counter in the animate method and use the modified counter in the
renderer(for selected state), all the painting logic should be placed in
the renderer.

Regards,
Chen

> Hi,
>
> I have created a class of MyList which “extends List”. For each list cell, I need to look after its drawing or animation.
> I was wondering if there is any way to know the Y position of current selected/focused list cell (I failed to find), or if there is any hidden method of such could be made available outside the LWUIT?
>
> To manually work out a cell’s Y position is possible but would be a bit ugly.
>
> Could you help please?
>
> Qunhuan
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 04 June 2008 17:30
> To: users@lwuit.dev.java.net
> Subject: Re: Is it a bug from the CellRenderer handling logic
>
> Hi Qunhuan,
> The List uses the Renderer to paint all elements therefore it is not a
> usual Component that has a parent or a state.
> Try the following to enable this feature:
> Extend the List Component and override the List animate method:
>
> class MyList extends List{
>
> public boolean animate(){
> boolean retVal = super.animate();
> //if the List is in the middle of an animation(usually when
> scrolling), don't interrupt
> if(retVal){
> return retVal;
> }
> //preform your animate code here...
> }
>
> }
>
> Then make sure the renderer uses the the variables you modified in the
> animate code above correctly.
> For ex:
> If you try to create a Ticker like functionality inside the List
> Renderer make sure only the selected item in the renderer uses the
> variables you modified above or else all cells will use the animation.
> Be aware that this approach might cause some performance penalty since
> the List iterate over all the visible elements every time animate
> returns true.
>
> Regards,
> Chen
>
>
>
>
> Qunhuan Mei wrote:
>
>> Greetings!
>>
>> After I managed to implement an animation handling logic for a Label content, I am hoping to have my own cell renderer for a List so that I can do some animation on any List’s cell content in focus. The List has been added to a Form in a usual way.
>>
>> The way I implemented my own cell render is also usual:
>>
>> public class CellRenderer extends DefaultListCellRenderer {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>>
>> Or (also tried)
>>
>> public class CellRenderer extends Label implements ListCellRenderer, Animation {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>> I managed to paint the cell content in my own way statically, that is, without animation.
>>
>> However, I failed in painting in animated way.
>>
>> What I did was inside paint(Graphics g) method, I call getComponentForm().registerAnimated(this);
>>
>> But the problem is getCompoentForm() always return null.
>>
>> I then try to use form.registerAnimated(this), where the form is the one which list is added to.
>>
>> After this registration, anmate() has been called endlessly while it always returns true. However, the problem is paint() is only called once and no successive calls at all, thus making animation logic fail.
>>
>> Any clue for correcting this or is it a bug?
>>
>> Many 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

Matteo Mazzotti

Hi again,
I tried to run the WTK memory monitor, as I wanted to gauge the performance
of the application I'm writing.
I've noticed that when focusing on a TextField, as the cursors blinks, a new
char object is created (this is misleading from the WTK I think, cos a char
is not really an object, or is it?) ...you know there is a table with all
the objects created, live, gc-ed, and so on
Obviously, for each object, some new stack (I guess) memory is allocated and
consumed.
Should we be concerned about that? I also noticed that by calling the GC
manually, they are all discarded and collected...

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,
The WTK memory monitor won't give you an exact memory usage of the
application.
Usually a MIDlet will consume some native memory you won't see in the
monitor, so you can use the monitor just to give you an estimation of
what happens and to check if the application is not holding a reference
to some object you expect to be removed by the gc.
In any case if you call the gc manually and the memory gets cleaned that
means everything is ok.

Regards,
Chen

Matteo Mazzotti wrote:
> Hi again,
> I tried to run the WTK memory monitor, as I wanted to gauge the performance
> of the application I'm writing.
> I've noticed that when focusing on a TextField, as the cursors blinks, a new
> char object is created (this is misleading from the WTK I think, cos a char
> is not really an object, or is it?) ...you know there is a table with all
> the objects created, live, gc-ed, and so on
> Obviously, for each object, some new stack (I guess) memory is allocated and
> consumed.
> Should we be concerned about that? I also noticed that by calling the GC
> manually, they are all discarded and collected...
>
> 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

ckurtm
Offline
Joined: 2008-03-12
Points: 0

I implemented the suggestion by Shai, thanks loads. It worked

Qunhuan Mei

Greetings!

After I managed to implement an animation handling logic for a Label content, I am hoping to have my own cell renderer for a List so that I can do some animation on any List’s cell content in focus. The List has been added to a Form in a usual way.

The way I implemented my own cell render is also usual:

public class CellRenderer extends DefaultListCellRenderer {
......
public void paint(Graphics g){
......
}
public boolean animate() {
return needsAnimation; //
}
}

Or (also tried)

public class CellRenderer extends Label implements ListCellRenderer, Animation {
......
public void paint(Graphics g){
......
}
public boolean animate() {
return needsAnimation; //
}
}

I managed to paint the cell content in my own way statically, that is, without animation.

However, I failed in painting in animated way.

What I did was inside paint(Graphics g) method, I call getComponentForm().registerAnimated(this);

But the problem is getCompoentForm() always return null.

I then try to use form.registerAnimated(this), where the form is the one which list is added to.

After this registration, anmate() has been called endlessly while it always returns true. However, the problem is paint() is only called once and no successive calls at all, thus making animation logic fail.

Any clue for correcting this or is it a bug?

Many thanks,

Qunhuan

chen

Hi Qunhuan,
The List uses the Renderer to paint all elements therefore it is not a
usual Component that has a parent or a state.
Try the following to enable this feature:
Extend the List Component and override the List animate method:

class MyList extends List{

public boolean animate(){
boolean retVal = super.animate();
//if the List is in the middle of an animation(usually when
scrolling), don't interrupt
if(retVal){
return retVal;
}
//preform your animate code here...
}

}

Then make sure the renderer uses the the variables you modified in the
animate code above correctly.
For ex:
If you try to create a Ticker like functionality inside the List
Renderer make sure only the selected item in the renderer uses the
variables you modified above or else all cells will use the animation.
Be aware that this approach might cause some performance penalty since
the List iterate over all the visible elements every time animate
returns true.

Regards,
Chen

Qunhuan Mei wrote:
> Greetings!
>
> After I managed to implement an animation handling logic for a Label content, I am hoping to have my own cell renderer for a List so that I can do some animation on any List’s cell content in focus. The List has been added to a Form in a usual way.
>
> The way I implemented my own cell render is also usual:
>
> public class CellRenderer extends DefaultListCellRenderer {
> ......
> public void paint(Graphics g){
> ......
> }
> public boolean animate() {
> return needsAnimation; //
> }
> }
>
>
> Or (also tried)
>
> public class CellRenderer extends Label implements ListCellRenderer, Animation {
> ......
> public void paint(Graphics g){
> ......
> }
> public boolean animate() {
> return needsAnimation; //
> }
> }
>
> I managed to paint the cell content in my own way statically, that is, without animation.
>
> However, I failed in painting in animated way.
>
> What I did was inside paint(Graphics g) method, I call getComponentForm().registerAnimated(this);
>
> But the problem is getCompoentForm() always return null.
>
> I then try to use form.registerAnimated(this), where the form is the one which list is added to.
>
> After this registration, anmate() has been called endlessly while it always returns true. However, the problem is paint() is only called once and no successive calls at all, thus making animation logic fail.
>
> Any clue for correcting this or is it a bug?
>
> Many thanks,
>
> Qunhuan
>

---------------------------------------------------------------------
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 very much INDEED for your helpful advice (and sorry for replying you late since at the time you replied me in States we are already off work in London due to time difference).

I have managed to implement the function along the route you advised. It is a success!

This LWUIT is truly well architectured. The open framework has made further extension very convenient and straightforward! Hats off to you guys in LWUIT team!

BTW, roughly when would the LWUIT source code would be released to the developer community?

Best regards,

Qunhuan

-----Original Message-----
From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
Sent: 04 June 2008 17:30
To: users@lwuit.dev.java.net
Subject: Re: Is it a bug from the CellRenderer handling logic

Hi Qunhuan,
The List uses the Renderer to paint all elements therefore it is not a
usual Component that has a parent or a state.
Try the following to enable this feature:
Extend the List Component and override the List animate method:

class MyList extends List{

public boolean animate(){
boolean retVal = super.animate();
//if the List is in the middle of an animation(usually when
scrolling), don't interrupt
if(retVal){
return retVal;
}
//preform your animate code here...
}

}

Then make sure the renderer uses the the variables you modified in the
animate code above correctly.
For ex:
If you try to create a Ticker like functionality inside the List
Renderer make sure only the selected item in the renderer uses the
variables you modified above or else all cells will use the animation.
Be aware that this approach might cause some performance penalty since
the List iterate over all the visible elements every time animate
returns true.

Regards,
Chen

Qunhuan Mei wrote:
> Greetings!
>
> After I managed to implement an animation handling logic for a Label content, I am hoping to have my own cell renderer for a List so that I can do some animation on any List’s cell content in focus. The List has been added to a Form in a usual way.
>
> The way I implemented my own cell render is also usual:
>
> public class CellRenderer extends DefaultListCellRenderer {
> ......
> public void paint(Graphics g){
> ......
> }
> public boolean animate() {
> return needsAnimation; //
> }
> }
>
>
> Or (also tried)
>
> public class CellRenderer extends Label implements ListCellRenderer, Animation {
> ......
> public void paint(Graphics g){
> ......
> }
> public boolean animate() {
> return needsAnimation; //
> }
> }
>
> I managed to paint the cell content in my own way statically, that is, without animation.
>
> However, I failed in painting in animated way.
>
> What I did was inside paint(Graphics g) method, I call getComponentForm().registerAnimated(this);
>
> But the problem is getCompoentForm() always return null.
>
> I then try to use form.registerAnimated(this), where the form is the one which list is added to.
>
> After this registration, anmate() has been called endlessly while it always returns true. However, the problem is paint() is only called once and no successive calls at all, thus making animation logic fail.
>
> Any clue for correcting this or is it a bug?
>
> Many 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,
we are working very hard with Sun legal on getting the source code
out the door. We don't think it will take too long since the code is
very clean (no encumbrances) but there is a process and there are
committees that should be satisfied that we did everything correctly.
Lots of small details.

Regardless of that Chen should release a binary drop later today
which contains lots of new features & bug fixes (check out the
release notes).

Thanks for your patience :-)
Shai.

> Hi Chen,
>
> Thanks very much INDEED for your helpful advice (and sorry for
> replying you late since at the time you replied me in States we are
> already off work in London due to time difference).
>
> I have managed to implement the function along the route you
> advised. It is a success!
>
> This LWUIT is truly well architectured. The open framework has made
> further extension very convenient and straightforward! Hats off to
> you guys in LWUIT team!
>
> BTW, roughly when would the LWUIT source code would be released to
> the developer community?
>
> Best regards,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 04 June 2008 17:30
> To: users@lwuit.dev.java.net
> Subject: Re: Is it a bug from the CellRenderer handling logic
>
> Hi Qunhuan,
> The List uses the Renderer to paint all elements therefore it is not a
> usual Component that has a parent or a state.
> Try the following to enable this feature:
> Extend the List Component and override the List animate method:
>
> class MyList extends List{
>
> public boolean animate(){
> boolean retVal = super.animate();
> //if the List is in the middle of an animation(usually when
> scrolling), don't interrupt
> if(retVal){
> return retVal;
> }
> //preform your animate code here...
> }
>
> }
>
> Then make sure the renderer uses the the variables you modified in the
> animate code above correctly.
> For ex:
> If you try to create a Ticker like functionality inside the List
> Renderer make sure only the selected item in the renderer uses the
> variables you modified above or else all cells will use the animation.
> Be aware that this approach might cause some performance penalty since
> the List iterate over all the visible elements every time animate
> returns true.
>
> Regards,
> Chen
>
>
>
>
> Qunhuan Mei wrote:
>> Greetings!
>>
>> After I managed to implement an animation handling logic for a
>> Label content, I am hoping to have my own cell renderer for a List
>> so that I can do some animation on any List’s cell content in
>> focus. The List has been added to a Form in a usual way.
>>
>> The way I implemented my own cell render is also usual:
>>
>> public class CellRenderer extends DefaultListCellRenderer {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>>
>> Or (also tried)
>>
>> public class CellRenderer extends Label implements
>> ListCellRenderer, Animation {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>> I managed to paint the cell content in my own way statically, that
>> is, without animation.
>>
>> However, I failed in painting in animated way.
>>
>> What I did was inside paint(Graphics g) method, I call
>> getComponentForm().registerAnimated(this);
>>
>> But the problem is getCompoentForm() always return null.
>>
>> I then try to use form.registerAnimated(this), where the form is
>> the one which list is added to.
>>
>> After this registration, anmate() has been called endlessly while
>> it always returns true. However, the problem is paint() is only
>> called once and no successive calls at all, thus making animation
>> logic fail.
>>
>> Any clue for correcting this or is it a bug?
>>
>> Many 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,

Thanks for bring us good news, and looking forward to using your new
library code :-)

Cheers,

Qunhuan

-----Original Message-----
From: Shai.Almog@Sun.COM [mailto:Shai.Almog@Sun.COM]
Sent: 05 June 2008 13:08
To: users@lwuit.dev.java.net
Subject: Re: Is it a bug from the CellRenderer handling logic

Hi Qunhuan,
we are working very hard with Sun legal on getting the source code
out the door. We don't think it will take too long since the code is
very clean (no encumbrances) but there is a process and there are
committees that should be satisfied that we did everything correctly.
Lots of small details.

Regardless of that Chen should release a binary drop later today
which contains lots of new features & bug fixes (check out the
release notes).

Thanks for your patience :-)
Shai.

> Hi Chen,
>
> Thanks very much INDEED for your helpful advice (and sorry for
> replying you late since at the time you replied me in States we are
> already off work in London due to time difference).
>
> I have managed to implement the function along the route you
> advised. It is a success!
>
> This LWUIT is truly well architectured. The open framework has made
> further extension very convenient and straightforward! Hats off to
> you guys in LWUIT team!
>
> BTW, roughly when would the LWUIT source code would be released to
> the developer community?
>
> Best regards,
>
> Qunhuan
>
>
>
> -----Original Message-----
> From: Chen.Fishbein@Sun.COM [mailto:Chen.Fishbein@Sun.COM]
> Sent: 04 June 2008 17:30
> To: users@lwuit.dev.java.net
> Subject: Re: Is it a bug from the CellRenderer handling logic
>
> Hi Qunhuan,
> The List uses the Renderer to paint all elements therefore it is not a
> usual Component that has a parent or a state.
> Try the following to enable this feature:
> Extend the List Component and override the List animate method:
>
> class MyList extends List{
>
> public boolean animate(){
> boolean retVal = super.animate();
> //if the List is in the middle of an animation(usually when
> scrolling), don't interrupt
> if(retVal){
> return retVal;
> }
> //preform your animate code here...
> }
>
> }
>
> Then make sure the renderer uses the the variables you modified in the
> animate code above correctly.
> For ex:
> If you try to create a Ticker like functionality inside the List
> Renderer make sure only the selected item in the renderer uses the
> variables you modified above or else all cells will use the animation.
> Be aware that this approach might cause some performance penalty since
> the List iterate over all the visible elements every time animate
> returns true.
>
> Regards,
> Chen
>
>
>
>
> Qunhuan Mei wrote:
>> Greetings!
>>
>> After I managed to implement an animation handling logic for a
>> Label content, I am hoping to have my own cell renderer for a List
>> so that I can do some animation on any List's cell content in
>> focus. The List has been added to a Form in a usual way.
>>
>> The way I implemented my own cell render is also usual:
>>
>> public class CellRenderer extends DefaultListCellRenderer {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>>
>> Or (also tried)
>>
>> public class CellRenderer extends Label implements
>> ListCellRenderer, Animation {
>> ......
>> public void paint(Graphics g){
>> ......
>> }
>> public boolean animate() {
>> return needsAnimation; //
>> }
>> }
>>
>> I managed to paint the cell content in my own way statically, that
>> is, without animation.
>>
>> However, I failed in painting in animated way.
>>
>> What I did was inside paint(Graphics g) method, I call
>> getComponentForm().registerAnimated(this);
>>
>> But the problem is getCompoentForm() always return null.
>>
>> I then try to use form.registerAnimated(this), where the form is
>> the one which list is added to.
>>
>> After this registration, anmate() has been called endlessly while
>> it always returns true. However, the problem is paint() is only
>> called once and no successive calls at all, thus making animation
>> logic fail.
>>
>> Any clue for correcting this or is it a bug?
>>
>> Many 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

Shai Almog

Hi ckurtm,
sure you can do that ;-)
Extend the ComboBox class and override keyReleased(int keyCode) in
code similar to this untested code:

protected void keyReleased(int code) {
super.keyReleased(code);

// assuming regular non qwerty phone you would need to implement
keyCodeToChar so it turns the key code
// into the appropriate character for that key and with
repeated presses moves to the next element e.g.:
// 2 will return A and then B and then C etc...
char c = keyCodeToChars(code);

if(c != 0) {
int modelSize = getModel().getSize();
for(int iter = 0 ; iter < modelSize ; iter++) {
// assuming model entries are Strings and never null...
String entry = (String)getModel().getItemAt(iter);
if(entry.startsWith("" + c)) {
setSelectedIndex(iter);
return;
}
}
}
}

Shai.

> Hi, I have a combo box with more that 20 listings, wanted to find
> out if theres a way of making it possible to autocomplete for an
> entry in the combobox,
> Say if i have a list {"one","two","three"}
>
> typing "t" would go and select the first occurance of t in the
> combobox list.
>
> Hope this makes sense
> [Message sent by forum member 'ckurtm' (ckurtm)]
>
> http://forums.java.net/jive/thread.jspa?messageID=277497
>
> ---------------------------------------------------------------------
> 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

ckurtm
Offline
Joined: 2008-03-12
Points: 0

Cool, thanks, never thought about that, let me try that out. Speedy response, thanks loads

chen

Hi,

lwuit-users@mobileandembedded.org wrote:
> Hi, I have a combo box with more that 20 listings, wanted to find out if theres a way of making it possible to autocomplete for an entry in the combobox,
> Say if i have a list {"one","two","three"}
>
> typing "t" would go and select the first occurance of t in the combobox list.
>
>
There is no option to this in the current API.
> Hope this makes sense
>
It does , we will add this to the requirements list.

Thanks,
Chen

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