有没有可能一些如何获得非过滤表对应的选择的索引?
在表格之后使用 regexFilter 进行过滤。 JTable getSelectedRow 返回筛选表的索引?
最佳答案
如果您使用的是 1.6 中内置的 TableRowSorter 功能,则可以在表格上使用 convertRowIndexToModel()。这会为您提供所选行的未过滤索引。
JTable 的 javadoc 对此进行了描述:
Coordinate conversions will be necessary when using the row based methods of JTable with the underlying TableModel. All of JTables row based methods are in terms of the RowSorter, which is not necessarily the same as that of the underlying TableModel. For example, the selection is always in terms of JTable so that when using RowSorter you will need to convert using convertRowIndexToView or convertRowIndexToModel.
关于java - JTable 行过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1316388/