forked from External/mage
UI: fixed row selecting in tables list
This commit is contained in:
parent
4349ec881e
commit
dd09de7a09
3 changed files with 38 additions and 17 deletions
|
|
@ -43,4 +43,21 @@ public class TablesUtil {
|
|||
return row;
|
||||
}
|
||||
|
||||
public static int getSelectedModelRow(JTable table) {
|
||||
return getModelRowFromView(table, table.getSelectedRow());
|
||||
}
|
||||
|
||||
public static int getModelRowFromView(JTable table, int viewRow) {
|
||||
if (viewRow != -1 && viewRow < table.getModel().getRowCount()) {
|
||||
return table.convertRowIndexToModel(viewRow);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getViewRowFromModel(JTable table, int modelRow) {
|
||||
if (modelRow != -1 && modelRow < table.getModel().getRowCount()) {
|
||||
return table.convertRowIndexToView(modelRow);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue