aspose file tools*
The moose likes Java Micro Edition and the fly likes LWUIT: Custom List Renderer with checkboxes to select multiple items Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "LWUIT: Custom List Renderer with checkboxes to select multiple items" Watch "LWUIT: Custom List Renderer with checkboxes to select multiple items" New topic
Author

LWUIT: Custom List Renderer with checkboxes to select multiple items

Mahendr Shinde
Ranch Hand

Joined: Sep 03, 2011
Posts: 38

I am learning LWUIT from last 2/3 days. I am having problem with Custom renderer for my List (LWUIT).
For individual components, (List Items)


and this is my custom renderer:


I have tried many different ways to solve this but no success!
NOTE: code in RED color is newest addition: it makes only ONE item selected and makes other unchecked, but i don't want to uncheck other (means till the time i make them unchecked)


There is still lot to learn!
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

I'm not familiar with LWUIT, but I do know that it has similarities with Swing.

In your code, you are checking the isSelected parameter, which depends on the list's selection model. I would guess that what you really need is to ignore that parameter and use the isSelected() of the SelectableListItem.

And in general, don't ever change any model state in a renderer call (nor in custom painting code, if you write any). So start by getting rid of the lineYou probably need to toggle the selected state of the SelectableListItem in a selection listener, if LWUIT has such a beast.


luck, db
There are no new questions, but there may be new answers.
Mahendr Shinde
Ranch Hand

Joined: Sep 03, 2011
Posts: 38

Thanks for your reply,
i have made few changes to my code, i have shifted logic to make checkboxes select/deselect in Action Listener and i have removed that line which you have mentioned.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LWUIT: Custom List Renderer with checkboxes to select multiple items
 
Similar Threads
problem selecting JList item
Radiobuttons in JTree
table using lwuit in j2me
JComboBox and "long" items rendered via HTML
Change the font in a JList