• Post Reply Bookmark Topic Watch Topic
  • New Topic

jTable and boolean

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm playing with jTable and when giving data to jTable i insert true or false
what i wanted was that when displaying, it would show, not TRUE/FALSE, but instead VERDADEIRO/FALSO, (in) my native language
how can i achieve it?

TiA
 
Brian Cole
Author
Ranch Hand
Posts: 920
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that's really what you want, you can write
a simple custom cell renderer like this


Then there are a couple of ways you can set
the table to use the renderer. One way is
myTable.getColumnModel().getColumn(theBooleanColumn).setCellRenderer(new Renderer());

I feel that I should point out that if you
simply return Boolean.class from your table
model's getColumnClass() method, then it
will use a checkbox-style renderer and editor
by default, and there will be no language issue.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it does work as i wanted
thanks a lot!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!