|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractCellEditor | +--javax.swing.DefaultCellEditor
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.
Inner Class Summary | |
protected class |
DefaultCellEditor.EditorDelegate
|
Field Summary | |
protected int |
clickCountToStart
|
protected DefaultCellEditor.EditorDelegate |
delegate
|
protected JComponent |
editorComponent
|
Fields inherited from class javax.swing.AbstractCellEditor |
changeEvent, listenerList |
Constructor Summary | |
DefaultCellEditor(JCheckBox checkBox)
Constructs a DefaultCellEditor object that uses a check box. |
|
DefaultCellEditor(JComboBox comboBox)
Constructs a DefaultCellEditor object that uses a combo box. |
|
DefaultCellEditor(JTextField textField)
Constructs a DefaultCellEditor that uses a text field. |
Method Summary | |
void |
cancelCellEditing()
Tell the editor to cancel editing and not accept any partially edited value. |
Object |
getCellEditorValue()
Returns the value contained in the editor |
int |
getClickCountToStart()
ClickCountToStart controls the number of clicks required to start editing. |
Component |
getComponent()
Returns the a reference to the editor component. |
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
Sets an initial value for the editor. |
Component |
getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
Sets an initial value for the editor. |
boolean |
isCellEditable(EventObject anEvent)
Ask the editor if it can start editing using anEvent. |
void |
setClickCountToStart(int count)
Specifies the number of clicks needed to start editing. |
boolean |
shouldSelectCell(EventObject anEvent)
The return value of shouldSelectCell() is a boolean indicating whether the editing cell should be selected or not. |
boolean |
stopCellEditing()
Tell the editor to stop editing and accept any partially edited value as the value of the editor. |
Methods inherited from class javax.swing.AbstractCellEditor |
addCellEditorListener, fireEditingCanceled, fireEditingStopped, removeCellEditorListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.CellEditor |
addCellEditorListener, removeCellEditorListener |
Field Detail |
protected JComponent editorComponent
protected DefaultCellEditor.EditorDelegate delegate
protected int clickCountToStart
Constructor Detail |
public DefaultCellEditor(JTextField textField)
x
- a JTextField object ...public DefaultCellEditor(JCheckBox checkBox)
x
- a JCheckBox object ...public DefaultCellEditor(JComboBox comboBox)
x
- a JComboBox object ...Method Detail |
public Component getComponent()
public void setClickCountToStart(int count)
count
- an int specifying the number of clicks needed to start editinggetClickCountToStart()
public int getClickCountToStart()
public Object getCellEditorValue()
CellEditor
getCellEditorValue
in interface CellEditor
public boolean isCellEditable(EventObject anEvent)
CellEditor
isCellEditable
in interface CellEditor
isCellEditable
in class AbstractCellEditor
javax.swing.CellEditor
anEvent
- the event the editor should use to consider
whether to begin editing or not.CellEditor.shouldSelectCell(java.util.EventObject)
public boolean shouldSelectCell(EventObject anEvent)
CellEditor
shouldSelectCell
in interface CellEditor
shouldSelectCell
in class AbstractCellEditor
javax.swing.CellEditor
anEvent
- the event the editor should use to start
editing.CellEditor.isCellEditable(java.util.EventObject)
public boolean stopCellEditing()
CellEditor
stopCellEditing
in interface CellEditor
stopCellEditing
in class AbstractCellEditor
javax.swing.CellEditor
public void cancelCellEditing()
CellEditor
cancelCellEditing
in interface CellEditor
cancelCellEditing
in class AbstractCellEditor
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
TreeCellEditor
Returns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input.
getTreeCellEditorComponent
in interface TreeCellEditor
javax.swing.tree.TreeCellEditor
table
- 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 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)
TableCellEditor
value
for the editor. This will cause
the editor to stopEditing
and lose any partially
edited value if the editor is editing when this method is called.
Returns the component that should be added to the client's
Component
hierarchy. Once installed in the client's
hierarchy this component will then be able to draw and receive
user input.
getTableCellEditorComponent
in interface TableCellEditor
javax.swing.table.TableCellEditor
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 valueisSelected
- true if the cell is to be rendered with
highlightingrow
- the row of the cell being editedcolumn
- the column of the cell being edited
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.