public class DefaultCellEditor extends AbstractCellEditorimplements 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 and Description |
|---|---|
protected class |
DefaultCellEditor
The protected
EditorDelegate class.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
clickCountToStart
An integer specifying the number of clicks needed to start editing.
|
protected DefaultCellEditor |
delegate
The delegate class which handles all methods sent from the
CellEditor.
|
protected JComponent |
editorComponent
The Swing component being edited.
|
changeEvent, listenerList| Constructor and Description |
|---|
DefaultCellEditor(JCheckBox
Constructs a
DefaultCellEditor object that uses a check box.
|
DefaultCellEditor(JComboBox
Constructs a
DefaultCellEditor object that uses a combo box.
|
DefaultCellEditor(JTextField
Constructs a
DefaultCellEditor that uses a text field.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelCellEditing()
Forwards the message from the
CellEditor to the
delegate.
|
Object |
getCellEditorValue()
Forwards the message from the
CellEditor to the
delegate.
|
int |
getClickCountToStart()
Returns the number of clicks needed to start editing.
|
Component |
getComponent()
Returns a reference to the editor component.
|
Component |
getTableCellEditorComponent(JTable
Implements the
TableCellEditor interface.
|
Component |
getTreeCellEditorComponent(JTree
Implements the
TreeCellEditor interface.
|
boolean |
isCellEditable(EventObject
Forwards the message from the
CellEditor to the
delegate.
|
void |
setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.
|
boolean |
shouldSelectCell(EventObject
Forwards the message from the
CellEditor to the
delegate.
|
boolean |
stopCellEditing()
Forwards the message from the
CellEditor to the
delegate.
|
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCellEditorListener, removeCellEditorListenerprotected JComponenteditorComponent
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(JTextFieldtextField)
DefaultCellEditor that uses a text field.
textField - a
JTextField object
public DefaultCellEditor(JCheckBoxcheckBox)
DefaultCellEditor object that uses a check box.
checkBox - a
JCheckBox object
public DefaultCellEditor(JComboBoxcomboBox)
DefaultCellEditor object that uses a combo box.
comboBox - a
JComboBox object
public ComponentgetComponent()
Component
public void setClickCountToStart(int count)
count - an int specifying the number of clicks needed to start editing
getClickCountToStart()
public int getClickCountToStart()
public ObjectgetCellEditorValue()
CellEditor to the
delegate.
getCellEditorValue in interface
CellEditor
DefaultCellEditor.EditorDelegate.getCellEditorValue()
public boolean isCellEditable(EventObjectanEvent)
CellEditor to the
delegate.
isCellEditable in interface
CellEditor
isCellEditable in class
AbstractCellEditor
anEvent - an event object
DefaultCellEditor.EditorDelegate.isCellEditable(EventObject)
public boolean shouldSelectCell(EventObjectanEvent)
CellEditor to the
delegate.
shouldSelectCell in interface
CellEditor
shouldSelectCell in class
AbstractCellEditor
anEvent - an event object
DefaultCellEditor.EditorDelegate.shouldSelectCell(EventObject)
public boolean stopCellEditing()
CellEditor to the
delegate.
stopCellEditing in interface
CellEditor
stopCellEditing in class
AbstractCellEditor
DefaultCellEditor.EditorDelegate.stopCellEditing()
public void cancelCellEditing()
CellEditor to the
delegate.
cancelCellEditing in interface
CellEditor
cancelCellEditing in class
AbstractCellEditor
DefaultCellEditor.EditorDelegate.cancelCellEditing()
public ComponentgetTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
TreeCellEditor interface.
getTreeCellEditorComponent in interface
TreeCellEditor
tree - the JTree that is asking the editor to edit; this parameter can be null
value - the value of the cell to be edited
isSelected - true if the cell is to be rendered with selection highlighting
expanded - true if the node is expanded
leaf - true if the node is a leaf node
row - the row index of the node being edited
public ComponentgetTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
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 value
isSelected - true if the cell is to be rendered with highlighting
row - the row of the cell being edited
column - the column of the cell being edited