是否可以通过在JTable上按下按键来将单元格设置为编辑模式?
我已经用过getTableName().changeSelection, getTableName().editCellAt
但这没用。
这是我当前的代码:
int row = 1;
int column = 13;
Object myCombobox = getTableName().getValueAt(row , column);
Action keyUp = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (myCombobox instanceof TCombo) {
TCombo cmb = (TCombo) myCombobox;
// Edit mode cell
}
}
};
KeyStroke up = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0);
getTableName().getInputMap().put(up, "keyUp");
getTableName().getActionMap().put("keyUp", keyUp);