Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Display zeros as blanks in JTable

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable that has a couple of columns that are of the Double class. If there happens to be a zero value, I want it to display as blanks. How can I accomplish this without making the column type String?
I want to keep the Double column class because I am allowing sorting on this column.
Any ideas?
Thanks!
 
Jon Dornback
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably need to create a custom cell renderer. That will let you override the default behaviour of how the cell is displayed. There's some basic info in the java table tutorial here:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!