где-то было уже на форуме, вход на редактирование ч/з ентер, вся ячейка сразу выделяется
| Код | tIndic.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),"cellediting"); tIndic.getActionMap().put("cellediting", new AbstractAction() { public void actionPerformed(ActionEvent e) { int row = tIndic.getSelectedRow(); int col = tIndic.getSelectedColumn();
if (tIndic.isEditing()) { tIndic.getCellEditor().stopCellEditing(); } else { tIndic.editCellAt(row,col); ((JTextField)tIndic.getDefaultEditor(Double.class).getTableCellEditorComponent(tIndic, tIndic.getValueAt(row, col), true, row, col)).grabFocus(); ((JTextField)tIndic.getDefaultEditor(Double.class).getTableCellEditorComponent(tIndic, tIndic.getValueAt(row, col), true, row, col)).selectAll(); } } });
|
tIndic - JTable |