public class DefaultCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor
 Warning:
 Serialized objects of this class will not be compatible with
 future Swing releases. The current serialization support is
 appropriate for short term storage or RMI between applications running
 the same version of Swing.  As of 1.4, support for long term storage
 of all JavaBeans™
 has been added to the java.beans package.
 Please see XMLEncoder.
| Modifier and Type | Class | Description | 
|---|---|---|
| protected class  | DefaultCellEditor.EditorDelegate | The protected  EditorDelegateclass. | 
| Modifier and Type | Field | Description | 
|---|---|---|
| protected int | clickCountToStart | An integer specifying the number of clicks needed to start editing. | 
| protected DefaultCellEditor.EditorDelegate | delegate | The delegate class which handles all methods sent from the
  CellEditor. | 
| protected JComponent | editorComponent | The Swing component being edited. | 
changeEvent, listenerList| Constructor | Description | 
|---|---|
| DefaultCellEditor(JCheckBox checkBox) | Constructs a  DefaultCellEditorobject that uses a check box. | 
| DefaultCellEditor(JComboBox comboBox) | Constructs a  DefaultCellEditorobject that uses a
 combo box. | 
| DefaultCellEditor(JTextField textField) | Constructs a  DefaultCellEditorthat uses a text field. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| void | cancelCellEditing() | Forwards the message from the  CellEditorto
 thedelegate. | 
| Object | getCellEditorValue() | Forwards the message from the  CellEditorto
 thedelegate. | 
| int | getClickCountToStart() | Returns the number of clicks needed to start editing. | 
| Component | getComponent() | Returns a reference to the editor component. | 
| Component | getTableCellEditorComponent(JTable table,
                           Object value,
                           boolean isSelected,
                           int row,
                           int column) | Implements the  TableCellEditorinterface. | 
| Component | getTreeCellEditorComponent(JTree tree,
                          Object value,
                          boolean isSelected,
                          boolean expanded,
                          boolean leaf,
                          int row) | Implements the  TreeCellEditorinterface. | 
| boolean | isCellEditable(EventObject anEvent) | Forwards the message from the  CellEditorto
 thedelegate. | 
| void | setClickCountToStart(int count) | Specifies the number of clicks needed to start editing. | 
| boolean | shouldSelectCell(EventObject anEvent) | Forwards the message from the  CellEditorto
 thedelegate. | 
| boolean | stopCellEditing() | Forwards the message from the  CellEditorto
 thedelegate. | 
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCellEditorListener, removeCellEditorListenerprotected JComponent editorComponent
protected DefaultCellEditor.EditorDelegate delegate
CellEditor.protected int clickCountToStart
clickCountToStart is defined as zero, it
 will not initiate until a click occurs.@ConstructorProperties(value="component") public DefaultCellEditor(JTextField textField)
DefaultCellEditor that uses a text field.textField - a JTextField objectpublic DefaultCellEditor(JCheckBox checkBox)
DefaultCellEditor object that uses a check box.checkBox - a JCheckBox objectpublic DefaultCellEditor(JComboBox comboBox)
DefaultCellEditor object that uses a
 combo box.comboBox - a JComboBox objectpublic Component getComponent()
Componentpublic void setClickCountToStart(int count)
count - an int specifying the number of clicks needed to start editinggetClickCountToStart()public int getClickCountToStart()
public Object getCellEditorValue()
CellEditor to
 the delegate.getCellEditorValue in interface CellEditorDefaultCellEditor.EditorDelegate.getCellEditorValue()public boolean isCellEditable(EventObject anEvent)
CellEditor to
 the delegate.isCellEditable in interface CellEditorisCellEditable in class AbstractCellEditoranEvent - an event objectDefaultCellEditor.EditorDelegate.isCellEditable(EventObject)public boolean shouldSelectCell(EventObject anEvent)
CellEditor to
 the delegate.shouldSelectCell in interface CellEditorshouldSelectCell in class AbstractCellEditoranEvent - an event objectDefaultCellEditor.EditorDelegate.shouldSelectCell(EventObject)public boolean stopCellEditing()
CellEditor to
 the delegate.stopCellEditing in interface CellEditorstopCellEditing in class AbstractCellEditorDefaultCellEditor.EditorDelegate.stopCellEditing()public void cancelCellEditing()
CellEditor to
 the delegate.cancelCellEditing in interface CellEditorcancelCellEditing in class AbstractCellEditorDefaultCellEditor.EditorDelegate.cancelCellEditing()public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
TreeCellEditor interface.getTreeCellEditorComponent in interface TreeCellEditortree - the JTree that is asking the editor to edit;
                          this parameter can be nullvalue - the value of the cell to be editedisSelected - true if the cell is to be rendered with
                          selection highlightingexpanded - true if the node is expandedleaf - true if the node is a leaf noderow - the row index of the node being editedpublic Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
TableCellEditor interface.getTableCellEditorComponent in interface TableCellEditortable - the JTable that is asking the
                          editor to edit; can be nullvalue - the value of the cell to be edited; it is
                          up to the specific editor to interpret
                          and draw the value.  For example, if value is
                          the string "true", it could be rendered as a
                          string or it could be rendered as a check
                          box that is checked.  null
                          is a valid valueisSelected - true if the cell is to be rendered with
                          highlightingrow - the row of the cell being editedcolumn - the column of the cell being edited Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.