>>>>> "fastegal" == fastegal <Kleopatra> writes:
fastegal> "David M. Karr" schrieb: >> >> I've done some more experimentation on this. I was able to go further on the >> idea of using a FocusListener because Kleopatra pointed out to me the new >> "setSurrendersFocusOnKeystroke()" method on "JTable". Using this, I could >> ensure that the spinner actually gets focus and later loses it (actually, it's >> the internal text field, not the spinner). Unfortunately, what I found was >> that just before the FocusListener is processed, the field has already been >> reverted to its old value. >> >> So, I found that the only practical solution is to set the internal text field >> to uneditable. In other words, to not allow manual editing of the text field. fastegal> Hm, I could not reproduce your problem, implementing a very rudimentary fastegal> CellEditor with JSpinner. On a first test it it always relays the edited fastegal> value to the table if commitEdit in called in stopCellEditing. Before fastegal> going on I would like to know why that's not working in your case, so fastegal> why do you need the focusListener at all? Do you have a little testcase fastegal> demonstrating the problem? Ok, I believe I have it working now. My problem was that I was not trying to do the commit in the "stopCellEditing" method of the CellEditor. It also appears to me that using "JTable.setSurrendersFocusOnKeystroke(true)" doesn't directly make any difference for this issue, however, I find that basic keyboard operations on tables don't work quite correctly if it is NOT set. I found that if I use the keyboard to navigate to cells whose editors are spinners or comboboxes (other editor types might behave similarly), then pressing the Spacebar sometimes does not put the cell into edit mode. However, when I set SFOK to true, I can't find a scenario where it fails to put it into edit mode upon pressing the Spacebar. What's even worse, when this flag is false, when I keyboard navigated to a cell edited by a spinner, and pressed the Spacebar, sometimes the cell would go into edit mode only "halfway". The editor component would seem to display, but it would continue to use the background color of the renderer label. -- =================================================================== David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] _______________________________________________ Swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/swing