This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class DefaultCellEditor

java.lang.Object extended by javax.swing.AbstractCellEditor extended by javax.swing.DefaultCellEditor
All Implemented Interfaces:
Serializable, CellEditor, TableCellEditor, TreeCellEditor

Most common way to construct:

JComboBox comboBox = …;

DefaultCellEditor comboBoxEditor = new DefaultCellEditor(comboBox);

Based on 14 examples


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 JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}.


Nested Class Summary
protected class

           The protected EditorDelegate class.
 
Field Summary
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 inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary

          Constructs a DefaultCellEditor object that uses a check box.

          Constructs a DefaultCellEditor object that uses a combo box.

          Constructs a DefaultCellEditor that uses a text field.
 
Method Summary
 void

          Forwards the message from the CellEditor to the delegate.
 Object

          Forwards the message from the CellEditor to the delegate.
 int

          Returns the number of clicks needed to start editing.
 Component

          Returns a reference to the editor component.
 Component
getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)

          Implements the TableCellEditor interface.
 Component
getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)

          Implements the TreeCellEditor interface.
 boolean

          Forwards the message from the CellEditor to the delegate.
 void

          Specifies the number of clicks needed to start editing.
 boolean

          Forwards the message from the CellEditor to the delegate.
 boolean

          Forwards the message from the CellEditor to the delegate.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clickCountToStart

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.

delegate

protected DefaultCellEditor.EditorDelegate delegate
The delegate class which handles all methods sent from the CellEditor.

editorComponent

protected JComponent editorComponent
The Swing component being edited.
Constructor Detail

DefaultCellEditor

public DefaultCellEditor(JCheckBox checkBox)
Constructs a DefaultCellEditor object that uses a check box.

Parameters:
checkBox - a JCheckBox object

DefaultCellEditor

public DefaultCellEditor(JComboBox comboBox)
Constructs a DefaultCellEditor object that uses a combo box.

Parameters:
comboBox - a JComboBox object

DefaultCellEditor

public DefaultCellEditor(JTextField textField)
Constructs a DefaultCellEditor that uses a text field.

Parameters:
textField - a JTextField object
Method Detail

cancelCellEditing

public void cancelCellEditing()
Forwards the message from the CellEditor to the delegate.

Overrides:
cancelCellEditing in class AbstractCellEditor

getCellEditorValue

public Object getCellEditorValue()
Forwards the message from the CellEditor to the delegate.


getClickCountToStart

public int getClickCountToStart()
Returns the number of clicks needed to start editing.

Returns:
the number of clicks needed to start editing

getComponent

public Component getComponent()
Returns a reference to the editor component.

Returns:
the editor Component

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Implements the TableCellEditor interface.

Parameters:
table
value
isSelected
row
column

getTreeCellEditorComponent

public Component getTreeCellEditorComponent(JTree tree,
                                            Object value,
                                            boolean isSelected,
                                            boolean expanded,
                                            boolean leaf,
                                            int row)
Implements the TreeCellEditor interface.

Parameters:
tree
value
isSelected
expanded
leaf
row

isCellEditable

public boolean isCellEditable(EventObject anEvent)
Forwards the message from the CellEditor to the delegate.

Overrides:
isCellEditable in class AbstractCellEditor
Parameters:
anEvent

setClickCountToStart

public void setClickCountToStart(int count)
Specifies the number of clicks needed to start editing.

Parameters:
count - an int specifying the number of clicks needed to start editing

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)
Forwards the message from the CellEditor to the delegate.

Overrides:
shouldSelectCell in class AbstractCellEditor
Parameters:
anEvent

stopCellEditing

public boolean stopCellEditing()
Forwards the message from the CellEditor to the delegate.

Overrides:
stopCellEditing in class AbstractCellEditor


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.