The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by iann]


Hi,

Real quick one: how can I force a JTable cell to complete editing from some
external event. IE: If the user is editing the contents of a JTABLE cell, but
has not pressed return, how can I have this cell complete editing when, say,
the user clicks on a JCheckBox?

Thanks in advance, Manning and its authors are kicking butt. And O'Reilly know
it smilie

Cheers
import-bot (20211) [Avatar] Offline
#2
Re: Forcing JTable cell editing completion
[Originally posted by matt]

myJTable.editingStopped(new ChangeEvent(myJTable));
import-bot (20211) [Avatar] Offline
#3
Re: Forcing JTable cell editing completion
[Originally posted by iann]

> myJTable.editingStopped(new ChangeEvent(myJTable));

Thanks Matt, what's the difference between the above and :-

myTable.getCellEditor().stopCellEditing();

Thanks!
import-bot (20211) [Avatar] Offline
#4
Re: Forcing JTable cell editing completion
[Originally posted by matt]

> what's the difference between the above and :-

> myTable.getCellEditor().stopCellEditing();
This one notifies all listeners registered with that editor.

> myJTable.editingStopped(new ChangeEvent(myJTable));
This one only notifies the table (which will be one of the listeners
registered with that editor).

I think your suggestion is the better way of doing this.

Have you tried either of them to see?