• Post Reply Bookmark Topic Watch Topic
  • New Topic

Feeding strings to CheckBoxCellEditor  RSS feed

 
Rob van Wees
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to display XML in a JTreeTable. In the XML, I have a property with value "true" or value "false", which I'd like to show as a checkbox. Is there a way to feed strings to a CheckBoxCellEditor?
 
Ashish Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,
U can parse the value read from XML by Boolean.parseBoolean(String) which will return boolean. After that u can set the state of the check box
 
Rob van Wees
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashish,
Thx. But that implies that I change my XML data before displaying it in the table, which is not what I wanted to do.
Is there a way (other than writing a CellEditor myself) to feed a string value to a DefaultCellEditor?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
( I assume you're talking about the JTreeTable here... )

The renderer and editors that display checkboxes assume that the table has a Boolean value in it. So you'll either have to cast your String data to a Boolean, or make your own renderer and editor to display the correct checkbox based off the string received.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!