在 Jtable 中隐藏特定的单元格网格

发布于 2024-09-17 00:29:00 字数 580 浏览 2 评论 0原文

我试图在 Jtable 中按 5、10、15、20 的步骤显示数字。

如果是 5,列名称将为 0,5,10,15...
如果是 10,列名称将为 0,10,20,30...
如果是 15,列名称将为 0,15,30,45...
如果是 20,列名称将为 0,20,40,60...

现在我可以显示 5,我需要的是相同的结构,但隐藏 5 和 10,15 和 20 之间的垂直单元格网格等等。毕竟我应该删除列名 5,15,25 等。它不会合并列,因为我的单元格正在实现 JProgressBar,我需要它以不同的比例绘制它。就像代表 0-5 的单元格一样可以从 0-3 或 3-5 或 2-4 进行绘制。每个单元格可以根据这样的某个值进行绘制。

编辑::与此 链接文本 但我的需要是通过隐藏网格而不是使用数组来合并几乎备用单元格。这就是为什么我提到它隐藏垂直边框而不是合并单元格。

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 structure 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹤仙姿 2024-09-24 00:29:19

我认为隐藏你不想看到的内容的最好方法就是删除它。

但是如果你想要隐藏或不可见,大多数swing组件都有一个方法调用

setVisible(boolean value)

这里有一个如何隐藏行的例子(我希望它有帮助):

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文