JTextField textEditor = new JTextField();
textEditor.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
TableCellEditor cellEditor = table.getCellEditor();
if (cellEditor != null){ //nullである可能性があるか分からないけど一応
cellEditor.stopCellEditing();
}
}
});
//2列目のCellEditorだけ変えてみる
table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(textEditor));
コメント