是否可以在没有表格的情况下将文本关联到 JTableHeader?

发布于 2024-08-05 19:01:29 字数 79 浏览 2 评论 0原文

我想创建一个 JTable,其中一些单元格内带有标题。但我想将文本与此标题相关联。是否可以?怎么办?

尽我所能! 莱安德罗·利马

I want to create a JTable with a header inside some cells. But I want to associate a text with this header. Is it possible? How to do?

All my best!
Leandro Lima

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

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

发布评论

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

评论(3

〃温暖了心ぐ 2024-08-12 19:01:29

如果我理解这个问题,那么您可以使用 BorderLayout 创建一个面板。将表添加到 CENTER,将表标题添加到 NORTH。

If I understand the question then you can create a panel using a BorderLayout. You add the table to the CENTER and the table header to the NORTH.

无声情话 2024-08-12 19:01:29
table.getColumnModel().getColumn(x).setHeaderValue( "text" );
table.getColumnModel().getColumn(x).setHeaderValue( "text" );
十六岁半 2024-08-12 19:01:29

我发现唯一的方法是创建一个表格,没有单元格,并且有一列带有标题标题。所以我得到这个标题并将其按单元格渲染器放入其他表中。

I only way to do it I found was to create a table, without cells and with a column with a header title. So I get this header and put it inside other table by cell renderer.

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