开发者

Hiding a particular cell grid in Jtable

开发者 https://www.devze.com 2023-01-14 14:41 出处:网络
I am trying to display numbers in the stepsof 5,10,15,20 in a Jtable. In case of 5 the column names willbe 0,5,10,15...

I am trying to display numbers in the steps of 5,10,15,20 in a Jtable.

In case of 5 the column names will be 0,5,10,15...

In case of 10 the column names will be 0,10,20,30...

In case of 15 the column names will be 0,15,30,45...

In case of 20 the column names will be 0,20,40,60...

Right now I am able to display 5 and what I need is the same str开发者_如何转开发ucture but by hiding the vertical cell grid between 5 and 10,15 and 20 and so on.After all this I should remove the column names 5,15,25 and so on.Its not merging columns because my cells are implementing JProgressBar and I need it for painting it in different proportions.Like a cell representing 0-5 may be painted from 0-3 or 3-5 or 2-4.And each cell may be painted based on some value like this.

EDIT::Something similar to Multiple - Span cell as in this link text but my need is merging almost alternate cells by hiding the grid rather than using an Array.Thats why I mentioned it as hiding the vertical border rather than merging the cell.


I think the best way to hide what you don't want to see is deleting it.

But If what you want is to hide or make invisible, most of swing components have a method call

setVisible(boolean value)

Here an example how to hide a row(I hope it helps):

http://www.rgagnon.com/javadetails/java-0216.html

0

精彩评论

暂无评论...
验证码 换一张
取 消