File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes format double precision in Jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "format double precision in Jtable" Watch "format double precision in Jtable" New topic

format double precision in Jtable

orey sattiga

Joined: Aug 27, 2002
Posts: 9
Hi ,
I need to format a column in a Jtable based on the some conditions. The column currently displays
double values without precision.
1) i need to display the double value only upto two decimal places.
2) I need to change the color of the text based one a condition.
My question is can i do both in the same cell renderer.. if so how??
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
I have some experience with JTable before, I think you may have to change number to string first to do this.
I agree. Here's the link:
subject: format double precision in Jtable
It's not a secret anymore!