Ну вопросы сам решил. Решение представлено ниже
| Код | jTable1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),"check"); jTable1.getActionMap().put("check", new AbstractAction() { public void actionPerformed(ActionEvent e) { int row = jTable1.getSelectedRow(); int col = jTable1.getSelectedColumn();
if (jTable1.isEditing()) { jTable1.getCellEditor().stopCellEditing(); } else { jTable1.editCellAt(row,col); ((JTextField)jTable1.getDefaultEditor(String.class).getTableCellEditorComponent(jTable1, jTable1.getValueAt(row, col), true, row, col)).grabFocus(); ((JTextField)jTable1.getDefaultEditor(String.class).getTableCellEditorComponent(jTable1, jTable1.getValueAt(row, col), true, row, col)).selectAll(); } } });
|
|