File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparing JTable cells

 
Frederick Pease
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to compare two JTabel cells in the same row, then whichever number is higher in the cell, set that cell's background color green, and the other red?
This is how my table looks right now:
 
K. Tsang
Bartender
Pie
Posts: 3226
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Are you using a TableModel to fetch your data? For the cell background color, a cell renderer will do the trick.

Depending on how you set up your classes/data, you may just do something like:

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic