javax.swing
public class DefaultCellEditor extends AbstractCellEditor implements TableCellEditor, TreeCellEditor
TableCellEditor
and
TreeCellEditor
. It provides editor components for
some standard object types.Modifier and Type | Class and Description |
---|---|
protected class |
DefaultCellEditor.EditorDelegate
This changeable module access the editor component in the component
specific way.
|
Modifier and Type | Field and Description |
---|---|
protected int |
clickCountToStart
The number of the mouse clicks, required to start the editing session.
|
protected DefaultCellEditor.EditorDelegate |
delegate
The editor delegate, responsible for listening the
editorComponent
events and getting/setting its value. |
protected JComponent |
editorComponent
The Swing JComponent, performing the editing session.
|
changeEvent, listenerList
Constructor and Description |
---|
DefaultCellEditor(JCheckBox checkbox)
Constructor DefaultCellEditor that uses the checkbox (appropriate
for boolean values)
|
DefaultCellEditor(JComboBox combobox)
Constructor DefaultCellEditor that uses the combo box.
|
DefaultCellEditor(JTextField textfield)
Create the DefaultCellEditor that uses the text field as its editor
component (appropriate for the text content)
|
Modifier and Type | Method and Description |
---|---|
void |
cancelCellEditing()
Forwards call to the
delegate . |
Object |
getCellEditorValue()
Get the value, currently being displayed by the editor component.
|
int |
getClickCountToStart()
Get the number of mouse clicks, required to start the editing session.
|
Component |
getComponent()
Get the component that performs the editing sessions.
|
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
Get the cell editor component that will perform the editing session.
|
Component |
getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
Sets an initial value for the editor.
|
boolean |
isCellEditable(EventObject event)
Forwards call to the
delegate . |
void |
setClickCountToStart(int count)
Set the number of mouse clicks, required to start the editing session.
|
boolean |
shouldSelectCell(EventObject event)
Forwards call to the
delegate . |
boolean |
stopCellEditing()
Forwards call to the
delegate . |
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addCellEditorListener, removeCellEditorListener
protected JComponent editorComponent
protected DefaultCellEditor.EditorDelegate delegate
editorComponent
events and getting/setting its value.protected int clickCountToStart
public DefaultCellEditor(JTextField textfield)
textfield
- the text field as will be used as the editor componentpublic DefaultCellEditor(JCheckBox checkbox)
checkbox
- the checkbox that will be used with this editor.public DefaultCellEditor(JComboBox combobox)
combobox
- the combo box that will be used with this editor.public Component getComponent()
public int getClickCountToStart()
public void setClickCountToStart(int count)
count
- the number of clicks, required to start the sessionpublic Object getCellEditorValue()
delegate
.getCellEditorValue
in interface CellEditor
public boolean isCellEditable(EventObject event)
delegate
.isCellEditable
in interface CellEditor
isCellEditable
in class AbstractCellEditor
event
- forwarded to the delegate.public boolean shouldSelectCell(EventObject event)
delegate
.shouldSelectCell
in interface CellEditor
shouldSelectCell
in class AbstractCellEditor
event
- forwarded to the delegate.public boolean stopCellEditing()
delegate
.stopCellEditing
in interface CellEditor
stopCellEditing
in class AbstractCellEditor
public void cancelCellEditing()
delegate
.cancelCellEditing
in interface CellEditor
cancelCellEditing
in class AbstractCellEditor
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
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 is the cell is to be renderer 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)
getTableCellEditorComponent
in interface TableCellEditor
table
- the table where the editing is performedvalue
- the current value of the table. It is set as the initial
component value.isSelected
- if true, the cell is currently selectedrow
- the row of the cell being editedcolumn
- the column of the cell being edited