Hi everyone!! I created JTable with JTextPane as cell editor.I want to stop cell editing and want to do some processing if I pressed enter key in JTextPane .And I also want to use single line in JTextPane. So, I add keylistener in JTextPane and call stopCellediting method. But it does not work, focus is in JTextPane and if I click other cell, the selected row and the selected column is not changed.So,please help me to use single line in JTextPane and to stop cell editing if I pressed enter like the default cell editor.Thanks a lot!!
A:
sounds like you want a custom cell editor that has a keylistener on it that listens for the "enter" key and then does the processing you want.
Jill Renee
2009-10-20 14:34:09
A:
Hi i have just come across the same issue, i have solved this by having a custom editor and overriding the default fireEditingCancled
private CelEditor extend AbstractCellEditor implements TableCellEditor
{
/* Other Code here for editor **/
protected void fireEditingCanceled()
{
this.stopCellEditing();
}
}
Took me awhile to figure this out, Also if this does not work you can try using model.setObject(Object, row,col) inside the cancel function.
kohlerfc
2010-08-11 05:01:47