java - Lose Focus and Commit Edit on a JSpinner when clicking outside the spinner -
I have jetties, whose cell editors are JSpinners, I am using a custom cell editor class to accomplish this. . There are some other components in my jepinel. My problem occurs when the user is editing a single cell (i.e. focuses on a JSPP) and then first interacts with any component without first losing access or focus. without. I want to reduce the changes before immediately focusing on JSpinner and running the code associated with other components, but JSPP has retained its focus instead.
Ideally, I would like JSPL to lose focus immediately, whenever the user clicks, but click inside himself within JSPN. Here is my custom editor class:
Public class PhymappingTableCellEditor extends AbstractCellEditor TableCellEditor {Last JSpinner spinner = new JSpinner (); Public PhyMappingTableCellEditor (ArrayList & lt; string & gt; phys) {spinner.setModel (new spinner listmodel (physical)); Spinner.setBorder (new blank border (0,0,0,0,0,0)); } @ Override public component getTableCellEditorComponent (JTable table, object value, boolean, selected, int row, int column) {spinner.setValue (value); Return spinner; } @OverWide public object getCellEditorValue () {return spinner.getValue (); thank you in advanced!
Believing your custom editor, when you work from cell to cell on the tab correctly The problem is that when you lose focus, the editing on the cell must be stopped manually.
Check out indicates that when the cell loses focus, how to stop editing on the cell. This solution will work for any cell that is being edited, not your custom editor.
Comments
Post a Comment