如何在针对模型使用 AutoBinding 的 JTable 中显示标题行

发布于 2024-10-02 17:02:01 字数 204 浏览 0 评论 0原文

由于某种原因,我的标题行不可见。我正在使用 SwingBindings.createJTableBinding 将 pojo 绑定到表。我的表格显示了所有行,但标题行不可见。

如果我检查表中的 JTableHeader 是否存在,并且其列的名称符合预期。 JTable 标头属性:isEnabled 和 isVisible 设置为 true。

我有什么遗漏的吗?

For some reason my header row is not visible. I am using SwingBindings.createJTableBinding to bind a pojo to the table. My table is showing all the rows however the header row is not visible.

If I inspect the JTableHeader in the table is there and its columns have names as expected. The JTable header properties: isEnabled and isVisible are set to true.

Is there something I am missing?

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

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

发布评论

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

评论(1

冷月断魂刀 2024-10-09 17:02:01

我不知道 SwingBindings.createJTableBinding 是什么,但是当您使用 Swing 时,您会将表添加到 JScrollPane 中。然后,表标题用作滚动窗格的列标题视图。

如果您不使用 JScrollPane,则需要使用 BorderLayout 创建 JPanel。该表被添加到 CENTER,表头被添加到 NORTH。

I don't know what SwingBindings.createJTableBinding is, but when you use Swing you add the table to a JScrollPane. The table header is then used as the column header view of the scrollpane.

If you are not using a JScrollPane, then you need to create a JPanel using a BorderLayout. The table is added to the CENTER and the table header is added to the NORTH.

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