javax.swing
Class DefaultCellEditor

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor 
      extended by javax.swing.DefaultCellEditor
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor , TableCellEditor sample code for javax.swing.table.TableCellEditor definition code for javax.swing.table.TableCellEditor , TreeCellEditor sample code for javax.swing.tree.TreeCellEditor definition code for javax.swing.tree.TreeCellEditor

public class DefaultCellEditor
extends AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
implements TableCellEditor sample code for javax.swing.table.TableCellEditor definition code for javax.swing.table.TableCellEditor , TreeCellEditor sample code for javax.swing.tree.TreeCellEditor definition code for javax.swing.tree.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 XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Nested Class Summary
protected  class DefaultCellEditor.EditorDelegate sample code for javax.swing.DefaultCellEditor.EditorDelegate definition code for javax.swing.DefaultCellEditor.EditorDelegate
          The protected EditorDelegate class.
 
Field Summary
protected  int clickCountToStart sample code for javax.swing.DefaultCellEditor.clickCountToStart definition code for javax.swing.DefaultCellEditor.clickCountToStart
          An integer specifying the number of clicks needed to start editing.
protected  DefaultCellEditor.EditorDelegate sample code for javax.swing.DefaultCellEditor.EditorDelegate definition code for javax.swing.DefaultCellEditor.EditorDelegate delegate sample code for javax.swing.DefaultCellEditor.delegate definition code for javax.swing.DefaultCellEditor.delegate
          The delegate class which handles all methods sent from the CellEditor.
protected  JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent editorComponent sample code for javax.swing.DefaultCellEditor.editorComponent definition code for javax.swing.DefaultCellEditor.editorComponent
          The Swing component being edited.
 
Fields inherited from class javax.swing.AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
changeEvent sample code for javax.swing.AbstractCellEditor.changeEvent definition code for javax.swing.AbstractCellEditor.changeEvent , listenerList sample code for javax.swing.AbstractCellEditor.listenerList definition code for javax.swing.AbstractCellEditor.listenerList
 
Constructor Summary
DefaultCellEditor sample code for javax.swing.DefaultCellEditor.DefaultCellEditor(javax.swing.JCheckBox) definition code for javax.swing.DefaultCellEditor.DefaultCellEditor(javax.swing.JCheckBox) (JCheckBox sample code for javax.swing.JCheckBox definition code for javax.swing.JCheckBox  checkBox)
          Constructs a DefaultCellEditor object that uses a check box.
DefaultCellEditor sample code for javax.swing.DefaultCellEditor.DefaultCellEditor(javax.swing.JComboBox) definition code for javax.swing.DefaultCellEditor.DefaultCellEditor(javax.swing.JComboBox) (JComboBox sample code for javax.swing.JComboBox definition code for javax.swing.JComboBox  comboBox)
          Constructs a DefaultCellEditor object that uses a combo box.
DefaultCellEditor sample code for javax.swing.DefaultCellEditor.DefaultCellEditor(javax.swing.JTextField) definition code for javax.swing.DefaultCellEditor.DefaultCellEditor(javax.swing.JTextField) (JTextField sample code for javax.swing.JTextField definition code for javax.swing.JTextField  textField)
          Constructs a DefaultCellEditor that uses a text field.
 
Method Summary
 void cancelCellEditing sample code for javax.swing.DefaultCellEditor.cancelCellEditing() definition code for javax.swing.DefaultCellEditor.cancelCellEditing() ()
          Forwards the message from the CellEditor to the delegate.
 Object sample code for java.lang.Object definition code for java.lang.Object getCellEditorValue sample code for javax.swing.DefaultCellEditor.getCellEditorValue() definition code for javax.swing.DefaultCellEditor.getCellEditorValue() ()
          Forwards the message from the CellEditor to the delegate.
 int getClickCountToStart sample code for javax.swing.DefaultCellEditor.getClickCountToStart() definition code for javax.swing.DefaultCellEditor.getClickCountToStart() ()
          Returns the number of clicks needed to start editing.
 Component sample code for java.awt.Component definition code for java.awt.Component getComponent sample code for javax.swing.DefaultCellEditor.getComponent() definition code for javax.swing.DefaultCellEditor.getComponent() ()
          Returns a reference to the editor component.
 Component sample code for java.awt.Component definition code for java.awt.Component getTableCellEditorComponent sample code for javax.swing.DefaultCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) definition code for javax.swing.DefaultCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) (JTable sample code for javax.swing.JTable definition code for javax.swing.JTable  table, Object sample code for java.lang.Object definition code for java.lang.Object  value, boolean isSelected, int row, int column)
          Implements the TableCellEditor interface.
 Component sample code for java.awt.Component definition code for java.awt.Component getTreeCellEditorComponent sample code for javax.swing.DefaultCellEditor.getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) definition code for javax.swing.DefaultCellEditor.getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) (JTree sample code for javax.swing.JTree definition code for javax.swing.JTree  tree, Object sample code for java.lang.Object definition code for java.lang.Object  value, boolean isSelected, boolean expanded, boolean leaf, int row)
          Implements the TreeCellEditor interface.
 boolean isCellEditable sample code for javax.swing.DefaultCellEditor.isCellEditable(java.util.EventObject) definition code for javax.swing.DefaultCellEditor.isCellEditable(java.util.EventObject) (EventObject sample code for java.util.EventObject definition code for java.util.EventObject  anEvent)
          Forwards the message from the CellEditor to the delegate.
 void setClickCountToStart sample code for javax.swing.DefaultCellEditor.setClickCountToStart(int) definition code for javax.swing.DefaultCellEditor.setClickCountToStart(int) (int count)
          Specifies the number of clicks needed to start editing.
 boolean shouldSelectCell sample code for javax.swing.DefaultCellEditor.shouldSelectCell(java.util.EventObject) definition code for javax.swing.DefaultCellEditor.shouldSelectCell(java.util.EventObject) (EventObject sample code for java.util.EventObject definition code for java.util.EventObject  anEvent)
          Forwards the message from the CellEditor to the delegate.
 boolean stopCellEditing sample code for javax.swing.DefaultCellEditor.stopCellEditing() definition code for javax.swing.DefaultCellEditor.stopCellEditing() ()
          Forwards the message from the CellEditor to the delegate.
 
Methods inherited from class javax.swing.AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
addCellEditorListener sample code for javax.swing.AbstractCellEditor.addCellEditorListener(javax.swing.event.CellEditorListener) definition code for javax.swing.AbstractCellEditor.addCellEditorListener(javax.swing.event.CellEditorListener) , fireEditingCanceled sample code for javax.swing.AbstractCellEditor.fireEditingCanceled() definition code for javax.swing.AbstractCellEditor.fireEditingCanceled() , fireEditingStopped sample code for javax.swing.AbstractCellEditor.fireEditingStopped() definition code for javax.swing.AbstractCellEditor.fireEditingStopped() , getCellEditorListeners sample code for javax.swing.AbstractCellEditor.getCellEditorListeners() definition code for javax.swing.AbstractCellEditor.getCellEditorListeners() , removeCellEditorListener sample code for javax.swing.AbstractCellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener) definition code for javax.swing.AbstractCellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface javax.swing.CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
addCellEditorListener sample code for javax.swing.CellEditor.addCellEditorListener(javax.swing.event.CellEditorListener) definition code for javax.swing.CellEditor.addCellEditorListener(javax.swing.event.CellEditorListener) , removeCellEditorListener sample code for javax.swing.CellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener) definition code for javax.swing.CellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener)
 
Methods inherited from interface javax.swing.CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
addCellEditorListener sample code for javax.swing.CellEditor.addCellEditorListener(javax.swing.event.CellEditorListener) definition code for javax.swing.CellEditor.addCellEditorListener(javax.swing.event.CellEditorListener) , removeCellEditorListener sample code for javax.swing.CellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener) definition code for javax.swing.CellEditor.removeCellEditorListener(javax.swing.event.CellEditorListener)
 

Field Detail

editorComponent sample code for javax.swing.DefaultCellEditor.editorComponent

protected JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent  editorComponent
The Swing component being edited.


delegate sample code for javax.swing.DefaultCellEditor.delegate

protected DefaultCellEditor.EditorDelegate sample code for javax.swing.DefaultCellEditor.EditorDelegate definition code for javax.swing.DefaultCellEditor.EditorDelegate  delegate
The delegate class which handles all methods sent from the CellEditor.


clickCountToStart sample code for javax.swing.DefaultCellEditor.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.

Constructor Detail

DefaultCellEditor sample code for javax.swing.DefaultCellEditor(javax.swing.JTextField) definition code for javax.swing.DefaultCellEditor(javax.swing.JTextField)

public DefaultCellEditor(JTextField sample code for javax.swing.JTextField definition code for javax.swing.JTextField  textField)
Constructs a DefaultCellEditor that uses a text field.

Parameters:
textField - a JTextField object

DefaultCellEditor sample code for javax.swing.DefaultCellEditor(javax.swing.JCheckBox) definition code for javax.swing.DefaultCellEditor(javax.swing.JCheckBox)

public DefaultCellEditor(JCheckBox sample code for javax.swing.JCheckBox definition code for javax.swing.JCheckBox  checkBox)
Constructs a DefaultCellEditor object that uses a check box.

Parameters:
checkBox - a JCheckBox object

DefaultCellEditor sample code for javax.swing.DefaultCellEditor(javax.swing.JComboBox) definition code for javax.swing.DefaultCellEditor(javax.swing.JComboBox)

public DefaultCellEditor(JComboBox sample code for javax.swing.JComboBox definition code for javax.swing.JComboBox  comboBox)
Constructs a DefaultCellEditor object that uses a combo box.

Parameters:
comboBox - a JComboBox object
Method Detail

getComponent sample code for javax.swing.DefaultCellEditor.getComponent() definition code for javax.swing.DefaultCellEditor.getComponent()

public Component sample code for java.awt.Component definition code for java.awt.Component  getComponent()
Returns a reference to the editor component.

Returns:
the editor Component

setClickCountToStart sample code for javax.swing.DefaultCellEditor.setClickCountToStart(int) definition code for javax.swing.DefaultCellEditor.setClickCountToStart(int)

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
See Also:
getClickCountToStart() sample code for javax.swing.DefaultCellEditor.getClickCountToStart() definition code for javax.swing.DefaultCellEditor.getClickCountToStart()

getClickCountToStart sample code for javax.swing.DefaultCellEditor.getClickCountToStart() definition code for javax.swing.DefaultCellEditor.getClickCountToStart()

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

Returns:
the number of clicks needed to start editing

getCellEditorValue sample code for javax.swing.DefaultCellEditor.getCellEditorValue() definition code for javax.swing.DefaultCellEditor.getCellEditorValue()

public Object sample code for java.lang.Object definition code for java.lang.Object  getCellEditorValue()
Forwards the message from the CellEditor to the delegate.

Specified by:
getCellEditorValue sample code for javax.swing.CellEditor.getCellEditorValue() definition code for javax.swing.CellEditor.getCellEditorValue() in interface CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
Returns:
the value contained in the editor
See Also:
DefaultCellEditor.EditorDelegate.getCellEditorValue() sample code for javax.swing.DefaultCellEditor.EditorDelegate.getCellEditorValue() definition code for javax.swing.DefaultCellEditor.EditorDelegate.getCellEditorValue()

isCellEditable sample code for javax.swing.DefaultCellEditor.isCellEditable(java.util.EventObject) definition code for javax.swing.DefaultCellEditor.isCellEditable(java.util.EventObject)

public boolean isCellEditable(EventObject sample code for java.util.EventObject definition code for java.util.EventObject  anEvent)
Forwards the message from the CellEditor to the delegate.

Specified by:
isCellEditable sample code for javax.swing.CellEditor.isCellEditable(java.util.EventObject) definition code for javax.swing.CellEditor.isCellEditable(java.util.EventObject) in interface CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
Overrides:
isCellEditable sample code for javax.swing.AbstractCellEditor.isCellEditable(java.util.EventObject) definition code for javax.swing.AbstractCellEditor.isCellEditable(java.util.EventObject) in class AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
Parameters:
anEvent - an event object
Returns:
true
See Also:
DefaultCellEditor.EditorDelegate.isCellEditable(EventObject) sample code for javax.swing.DefaultCellEditor.EditorDelegate.isCellEditable(java.util.EventObject) definition code for javax.swing.DefaultCellEditor.EditorDelegate.isCellEditable(java.util.EventObject)

shouldSelectCell sample code for javax.swing.DefaultCellEditor.shouldSelectCell(java.util.EventObject) definition code for javax.swing.DefaultCellEditor.shouldSelectCell(java.util.EventObject)

public boolean shouldSelectCell(EventObject sample code for java.util.EventObject definition code for java.util.EventObject  anEvent)
Forwards the message from the CellEditor to the delegate.

Specified by:
shouldSelectCell sample code for javax.swing.CellEditor.shouldSelectCell(java.util.EventObject) definition code for javax.swing.CellEditor.shouldSelectCell(java.util.EventObject) in interface CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
Overrides:
shouldSelectCell sample code for javax.swing.AbstractCellEditor.shouldSelectCell(java.util.EventObject) definition code for javax.swing.AbstractCellEditor.shouldSelectCell(java.util.EventObject) in class AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
Parameters:
anEvent - an event object
Returns:
true
See Also:
DefaultCellEditor.EditorDelegate.shouldSelectCell(EventObject) sample code for javax.swing.DefaultCellEditor.EditorDelegate.shouldSelectCell(java.util.EventObject) definition code for javax.swing.DefaultCellEditor.EditorDelegate.shouldSelectCell(java.util.EventObject)

stopCellEditing sample code for javax.swing.DefaultCellEditor.stopCellEditing() definition code for javax.swing.DefaultCellEditor.stopCellEditing()

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

Specified by:
stopCellEditing sample code for javax.swing.CellEditor.stopCellEditing() definition code for javax.swing.CellEditor.stopCellEditing() in interface CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
Overrides:
stopCellEditing sample code for javax.swing.AbstractCellEditor.stopCellEditing() definition code for javax.swing.AbstractCellEditor.stopCellEditing() in class AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
Returns:
true
See Also:
DefaultCellEditor.EditorDelegate.stopCellEditing() sample code for javax.swing.DefaultCellEditor.EditorDelegate.stopCellEditing() definition code for javax.swing.DefaultCellEditor.EditorDelegate.stopCellEditing()

cancelCellEditing sample code for javax.swing.DefaultCellEditor.cancelCellEditing() definition code for javax.swing.DefaultCellEditor.cancelCellEditing()

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

Specified by:
cancelCellEditing sample code for javax.swing.CellEditor.cancelCellEditing() definition code for javax.swing.CellEditor.cancelCellEditing() in interface CellEditor sample code for javax.swing.CellEditor definition code for javax.swing.CellEditor
Overrides:
cancelCellEditing sample code for javax.swing.AbstractCellEditor.cancelCellEditing() definition code for javax.swing.AbstractCellEditor.cancelCellEditing() in class AbstractCellEditor sample code for javax.swing.AbstractCellEditor definition code for javax.swing.AbstractCellEditor
See Also:
DefaultCellEditor.EditorDelegate.cancelCellEditing() sample code for javax.swing.DefaultCellEditor.EditorDelegate.cancelCellEditing() definition code for javax.swing.DefaultCellEditor.EditorDelegate.cancelCellEditing()

getTreeCellEditorComponent sample code for javax.swing.DefaultCellEditor.getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) definition code for javax.swing.DefaultCellEditor.getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int)

public Component sample code for java.awt.Component definition code for java.awt.Component  getTreeCellEditorComponent(JTree sample code for javax.swing.JTree definition code for javax.swing.JTree  tree,
                                            Object sample code for java.lang.Object definition code for java.lang.Object  value,
                                            boolean isSelected,
                                            boolean expanded,
                                            boolean leaf,
                                            int row)
Implements the TreeCellEditor interface.

Specified by:
getTreeCellEditorComponent sample code for javax.swing.tree.TreeCellEditor.getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) definition code for javax.swing.tree.TreeCellEditor.getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) in interface TreeCellEditor sample code for javax.swing.tree.TreeCellEditor definition code for javax.swing.tree.TreeCellEditor
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 is the cell is to be renderer 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 sample code for javax.swing.DefaultCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) definition code for javax.swing.DefaultCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)

public Component sample code for java.awt.Component definition code for java.awt.Component  getTableCellEditorComponent(JTable sample code for javax.swing.JTable definition code for javax.swing.JTable  table,
                                             Object sample code for java.lang.Object definition code for java.lang.Object  value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Implements the TableCellEditor interface.

Specified by:
getTableCellEditorComponent sample code for javax.swing.table.TableCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) definition code for javax.swing.table.TableCellEditor.getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) in interface TableCellEditor sample code for javax.swing.table.TableCellEditor definition code for javax.swing.table.TableCellEditor
Parameters:
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
Returns:
the component for editing