2

This Scenario may sound silly... but this was the observation...

When a mouse click on the the JTable cell... Cell is gets into the editor mode, while in the editor and a invalid entry is made (JTextFeild Component is installed in each cell), the focus is restricted in the editor mode by returning false instead of super.return stopCellEditing(); while validation and test field is painted red.

In the false mode, if user clicks anywhere on the table or outside the table the focus is not lost, but when the user clicks on the JTable header the focus is lost from the cell... I need to restrict this... How can this be achieved

Thank You in Advance...

Jeetesh Nataraj
  • 608
  • 2
  • 8
  • 20
  • @trashgod .. ehh ... how is the autocreateRowSorter related to this? starting to believe that I read a question different from the one all others read :-) – kleopatra Sep 20 '11 at 08:58
  • Why would you want to do this? It may help to provide an [sscce](http://sscce.org/) that exhibits the problem you describe. – trashgod Sep 20 '11 at 09:03
  • 1
    Thanks... just out of curiosity... thanks for the link @trashgod – Jeetesh Nataraj Sep 20 '11 at 10:46

3 Answers3

2

just to make sure: the editing is canceled in that case (though not exactly on click but on any mouse gesture which might be interpreted as starting a column move/resize, if I remember correctly), right?

If so, it's

  • a long standing bug, table silently removes editors on receiving change notifications from the column model
  • even if fixed, (arguably, of course) not the best user experience to not allow moving out
kleopatra
  • 51,061
  • 28
  • 99
  • 211
2

You might look at @camickr's TablePopupEditor, which uses a modal dialog to edit.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
1

This can actually be possible by disabling

table.getTableHeader().setReorderingAllowed(false); table.getTableHeader().setResizingAllowed(false);

Currently its working, but don't know under what circumstances it may fail.

Thank You

Jeetesh Nataraj
  • 608
  • 2
  • 8
  • 20