• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

LWUIT: Custom List Renderer with checkboxes to select multiple items

 
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Java
  • 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)
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • 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 Tomcat Server Java
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!