Java Platform 1.2

javax.swing
Class DefaultCellEditor

java.lang.Object
  |
  +--javax.swing.DefaultCellEditor

public class DefaultCellEditor
extends Object
implements TableCellEditor, TreeCellEditor, Serializable

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. A future release of Swing will provide support for long term persistence.

See Also:
Serialized Form

Inner Class Summary
protected  class DefaultCellEditor.EditorDelegate
           
 
Field Summary
protected  ChangeEvent changeEvent
           
protected  int clickCountToStart
           
protected  DefaultCellEditor.EditorDelegate delegate
           
protected  JComponent editorComponent
           
protected  EventListenerList listenerList
          Event listeners
 
Constructor Summary
DefaultCellEditor(JCheckBox x)
          Constructs a DefaultCellEditor object that uses a check box.
DefaultCellEditor(JComboBox x)
          Constructs a DefaultCellEditor object that uses a combo box.
DefaultCellEditor(JTextField x)
          Constructs a DefaultCellEditor that uses a text field.
 
Method Summary
 void addCellEditorListener(CellEditorListener l)
           
 void cancelCellEditing()
           
protected  void fireEditingCanceled()
           
protected  void fireEditingStopped()
           
 Object getCellEditorValue()
           
 int getClickCountToStart()
          clickCountToStart controls the number of clicks required to start editing if the event passed to isCellEditable() or startCellEditing() is a MouseEvent.
 Component getComponent()
          Returns the a reference to the editor component.
 Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
           
 Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
           
 boolean isCellEditable(EventObject anEvent)
           
 void removeCellEditorListener(CellEditorListener l)
           
 void setClickCountToStart(int count)
          Specifies the number of clicks needed to start editing.
 boolean shouldSelectCell(EventObject anEvent)
           
 boolean stopCellEditing()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected EventListenerList listenerList
Event listeners

changeEvent

protected transient ChangeEvent changeEvent

editorComponent

protected JComponent editorComponent

delegate

protected DefaultCellEditor.EditorDelegate delegate

clickCountToStart

protected int clickCountToStart
Constructor Detail

DefaultCellEditor

public DefaultCellEditor(JTextField x)
Constructs a DefaultCellEditor that uses a text field.
Parameters:
x - a JTextField object ...

DefaultCellEditor

public DefaultCellEditor(JCheckBox x)
Constructs a DefaultCellEditor object that uses a check box.
Parameters:
x - a JCheckBox object ...

DefaultCellEditor

public DefaultCellEditor(JComboBox x)
Constructs a DefaultCellEditor object that uses a combo box.
Parameters:
x - a JComboBox object ...
Method Detail

getComponent

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

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
See Also:
getClickCountToStart()

getClickCountToStart

public int getClickCountToStart()
clickCountToStart controls the number of clicks required to start editing if the event passed to isCellEditable() or startCellEditing() is a MouseEvent. For example, by default the clickCountToStart for a JTextField is set to 2, so in a JTable the user will need to double click to begin editing a cell.

getCellEditorValue

public Object getCellEditorValue()

isCellEditable

public boolean isCellEditable(EventObject anEvent)

shouldSelectCell

public boolean shouldSelectCell(EventObject anEvent)

stopCellEditing

public boolean stopCellEditing()

cancelCellEditing

public void cancelCellEditing()

addCellEditorListener

public void addCellEditorListener(CellEditorListener l)

removeCellEditorListener

public void removeCellEditorListener(CellEditorListener l)

fireEditingStopped

protected void fireEditingStopped()

fireEditingCanceled

protected void fireEditingCanceled()

getTreeCellEditorComponent

public Component getTreeCellEditorComponent(JTree tree,
                                            Object value,
                                            boolean isSelected,
                                            boolean expanded,
                                            boolean leaf,
                                            int row)
Specified by:
getTreeCellEditorComponent in interface TreeCellEditor

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Specified by:
getTableCellEditorComponent in interface TableCellEditor

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.