Class DefaultCellEditor
- All Implemented Interfaces:
-
Serializable
,CellEditor
,TableCellEditor
,TreeCellEditor
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
.
- Since:
- 1.2
Nested Class Summary
Modifier and Type | Class | Description |
---|---|---|
protected class |
DefaultCellEditor.EditorDelegate |
The protected EditorDelegate class. |
Field Summary
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. |
Fields declared in class javax.swing.AbstractCellEditor
changeEvent, listenerList
Constructor Summary
Constructor | Description |
---|---|
DefaultCellEditor |
Constructs a DefaultCellEditor object that uses a check box. |
DefaultCellEditor |
Constructs a DefaultCellEditor object that uses a combo box. |
DefaultCellEditor |
Constructs a DefaultCellEditor that uses a text field. |
Method Summary
Modifier and Type | Method | 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 |
Implements the TableCellEditor interface. |
Component |
getTreeCellEditorComponent |
Implements the TreeCellEditor interface. |
boolean |
isCellEditable |
Forwards the message from the CellEditor to the delegate . |
void |
setClickCountToStart |
Specifies the number of clicks needed to start editing. |
boolean |
shouldSelectCell |
Forwards the message from the CellEditor to the delegate . |
boolean |
stopCellEditing() |
Forwards the message from the CellEditor to the delegate . |
Methods declared in class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface javax.swing.CellEditor
addCellEditorListener, removeCellEditorListener
Field Details
editorComponent
protected JComponent editorComponent
delegate
protected DefaultCellEditor.EditorDelegate delegate
CellEditor
.clickCountToStart
protected int clickCountToStart
clickCountToStart
is defined as zero, it will not initiate until a click occurs.Constructor Details
DefaultCellEditor
@ConstructorProperties("component") public DefaultCellEditor(JTextField textField)
DefaultCellEditor
that uses a text field.- Parameters:
-
textField
- aJTextField
object
DefaultCellEditor
public DefaultCellEditor(JCheckBox checkBox)
DefaultCellEditor
object that uses a check box.- Parameters:
-
checkBox
- aJCheckBox
object
DefaultCellEditor
public DefaultCellEditor(JComboBox<?> comboBox)
DefaultCellEditor
object that uses a combo box.- Parameters:
-
comboBox
- aJComboBox
object
Method Details
getComponent
public Component getComponent()
- Returns:
- the editor
Component
setClickCountToStart
public void setClickCountToStart(int count)
- Parameters:
-
count
- an int specifying the number of clicks needed to start editing - See Also:
getClickCountToStart
public int getClickCountToStart()
- Returns:
- the number of clicks needed to start editing
getCellEditorValue
public Object getCellEditorValue()
CellEditor
to the delegate
.- Specified by:
-
getCellEditorValue
in interfaceCellEditor
- Returns:
- the value contained in the editor
- See Also:
isCellEditable
public boolean isCellEditable(EventObject anEvent)
CellEditor
to the delegate
.- Specified by:
-
isCellEditable
in interfaceCellEditor
- Overrides:
-
isCellEditable
in classAbstractCellEditor
- Parameters:
-
anEvent
- an event object - Returns:
- true
- See Also:
shouldSelectCell
public boolean shouldSelectCell(EventObject anEvent)
CellEditor
to the delegate
.- Specified by:
-
shouldSelectCell
in interfaceCellEditor
- Overrides:
-
shouldSelectCell
in classAbstractCellEditor
- Parameters:
-
anEvent
- an event object - Returns:
- true
- See Also:
stopCellEditing
public boolean stopCellEditing()
CellEditor
to the delegate
.- Specified by:
-
stopCellEditing
in interfaceCellEditor
- Overrides:
-
stopCellEditing
in classAbstractCellEditor
- Returns:
- true
- See Also:
cancelCellEditing
public void cancelCellEditing()
CellEditor
to the delegate
.- Specified by:
-
cancelCellEditing
in interfaceCellEditor
- Overrides:
-
cancelCellEditing
in classAbstractCellEditor
- See Also:
getTreeCellEditorComponent
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
TreeCellEditor
interface.- Specified by:
-
getTreeCellEditorComponent
in interfaceTreeCellEditor
- Parameters:
-
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 - Returns:
- the component for editing
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
TableCellEditor
interface.- Specified by:
-
getTableCellEditorComponent
in interfaceTableCellEditor
- Parameters:
-
table
- theJTable
that is asking the editor to edit; can benull
-
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 - Returns:
- the component for editing
© 1993, 2021, 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.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/DefaultCellEditor.html