public class DefaultCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor
The default editor for table and tree cells.
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 and Description |
|---|---|
protected class |
DefaultCellEditor.EditorDelegate The protected |
protected JComponent editorComponent
The Swing component being edited.
protected DefaultCellEditor.EditorDelegate delegate
The delegate class which handles all methods sent from the CellEditor.
protected int clickCountToStart
An integer specifying the number of clicks needed to start editing. Even if clickCountToStart is defined as zero, it will not initiate until a click occurs.
@ConstructorProperties(value="component") public DefaultCellEditor(JTextField textField)
Constructs a DefaultCellEditor that uses a text field.
textField - a JTextField objectpublic DefaultCellEditor(JCheckBox checkBox)
Constructs a DefaultCellEditor object that uses a check box.
checkBox - a JCheckBox objectpublic DefaultCellEditor(JComboBox comboBox)
Constructs a DefaultCellEditor object that uses a combo box.
comboBox - a JComboBox objectpublic Component getComponent()
Returns a reference to the editor component.
Component
public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.
count - an int specifying the number of clicks needed to start editinggetClickCountToStart()public int getClickCountToStart()
Returns the number of clicks needed to start editing.
public Object getCellEditorValue()
Forwards the message from the CellEditor to the delegate.
getCellEditorValue in interface CellEditor
DefaultCellEditor.EditorDelegate.getCellEditorValue()public boolean isCellEditable(EventObject anEvent)
Forwards the message from the CellEditor to the delegate.
isCellEditable in interface CellEditor
isCellEditable in class AbstractCellEditor
anEvent - an event objectDefaultCellEditor.EditorDelegate.isCellEditable(EventObject)public boolean shouldSelectCell(EventObject anEvent)
Forwards the message from the CellEditor to the delegate.
shouldSelectCell in interface CellEditor
shouldSelectCell in class AbstractCellEditor
anEvent - an event objectDefaultCellEditor.EditorDelegate.shouldSelectCell(EventObject)public boolean stopCellEditing()
Forwards the message from the CellEditor to the delegate.
stopCellEditing in interface CellEditor
stopCellEditing in class AbstractCellEditor
DefaultCellEditor.EditorDelegate.stopCellEditing()public void cancelCellEditing()
Forwards the message from the CellEditor to the delegate.
cancelCellEditing in interface CellEditor
cancelCellEditing in class AbstractCellEditor
DefaultCellEditor.EditorDelegate.cancelCellEditing()public Component getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row) Implements the TreeCellEditor interface.
getTreeCellEditorComponent in interface TreeCellEditor
tree - 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) Implements the TableCellEditor interface.
getTableCellEditorComponent in interface TableCellEditor
table - the JTable that is asking the editor to edit; can be null
value - 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
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.