Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LWUIT: Custom List Renderer with checkboxes to select multiple items

 
Mahendr Shinde
Ranch Hand
Posts: 38
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mahendr Shinde
Ranch Hand
Posts: 38
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic