tags:

views:

152

answers:

2

Is it possible to paint a JTable cell alone partially?Like 40% of it is green remaining is red?

+2  A: 

From what you say, I understand you want to do progress-bar like painting in a JTable cell. if so, you could be interested by those old Swing examples.

Riduidel
Thanks for that but my need is it can start from any part of the cell.Meaning Progress bar starts from 0 to 100 but mine is like a new bar should start in between like 40%.IN that case will progress bar be useful?
Harish
A: 

In a Jtable you can implement your own cellrenderer more on Jtables in

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

in the renderer you can paint anyway you want

Peter
Using renderer we can paint anyway inside intercells.What I am talking about is intracell
Harish
You got me confused there, what are intercells and intracells and how do they related to a Jtable with cells and borders between cells ?
Peter
ok let me be clear.Forget intra and intercells.Imagine I have a table with 3 rows and 3 columns represented by A1,A2,A3 B1,B2,B3 and C1,C2,C3 and take the cell C1 for example.Now this cell should be colored in such a way that the first 20% of the cell is white and the remaining is green.Cell C2 should have the first 50% colored and the next 50% as white.Now while coloring there should not be any number or % displayed (which is why progress bar will fail as it will contain the %)
Harish