如何在多重选择期间获得JTable中的聚焦单元格

时间:2022-04-12 23:13:21

I have a JTable with 10 rows. If I have multiple selections on the JTable, how do I get the cell that is currently focused?

我有一个10行的JTable。如果我在JTable上有多个选择,我如何获得当前关注的单元格?

I have tried to used JTable's getEditingColumn() and getEditingRow(), but they always return -1 during multiple selection.

我曾尝试使用JTable的getEditingColumn()和getEditingRow(),但在多次选择期间它们总是返回-1。

1 个解决方案

#1


10  

The commands;

命令;

table.getSelectionModel().getLeadSelectionIndex();
table.getColumnModel().getSelectionModel().getLeadSelectionIndex();

give the focus row and column respectively.

分别给出焦点行和列。

#1


10  

The commands;

命令;

table.getSelectionModel().getLeadSelectionIndex();
table.getColumnModel().getSelectionModel().getLeadSelectionIndex();

give the focus row and column respectively.

分别给出焦点行和列。