如何在两个 jtable 之间共享相同的视图

How to share the same view between two jtable

我有两个水平放置的 JTable 共享相同的行选择模型。只有右边的在JScrollPane里面,有一个垂直滚动条。

我需要为两个表共享相同的视图,因此在必要时,还强制滚动条向上或向下移动,以保持视图对齐。

The problem is that I needed to fix the first column of the JTable (that's why I made two JTables)

那么您可以将第一个 table 添加为滚动窗格的 "row header"。然后两个组件将同步滚动,因为行 header 和视口都是滚动窗格的一部分。

请参阅 Fixed Column Table 以了解此方法的可重用实现,它为您在 header 行中创建 table 用途。