|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
javax.swing.tree.DefaultTreeCellEditor
, EventListener
, CellEditor
, TreeSelectionListener
, TreeCellEditor

public class DefaultTreeCellEditor

, TreeCellEditor
, TreeSelectionListener

A TreeCellEditor. You need to supply an
instance of DefaultTreeCellRenderer
so that the icons can be obtained. You can optionally supply
a TreeCellEditor that will be layed out according
to the icon in the DefaultTreeCellRenderer.
If you do not supply a TreeCellEditor,
a TextField will be used. Editing is started
on a triple mouse click, or after a click, pause, click and
a delay of 1200 miliseconds.
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
.
JTree

| Nested Class Summary | |
|---|---|
class |
DefaultTreeCellEditor.DefaultTextField
TextField used when no editor is supplied. |
class |
DefaultTreeCellEditor.EditorContainer
Container responsible for placing the editingComponent. |
| Field Summary | |
|---|---|
protected Color |
borderSelectionColor
True if the border selection color should be drawn. |
protected boolean |
canEdit
As of Java 2 platform v1.4 this field should no longer be used. |
protected Component |
editingComponent
Component used in editing, obtained from the editingContainer. |
protected Container |
editingContainer
Editing container, will contain the editorComponent. |
protected Icon |
editingIcon
Icon to use when editing. |
protected Font |
font
Font to paint with, null indicates
font of renderer is to be used. |
protected TreePath |
lastPath
Last path that was selected. |
protected int |
lastRow
Row that was last passed into getTreeCellEditorComponent. |
protected int |
offset
Used in editing. |
protected TreeCellEditor |
realEditor
Editor handling the editing. |
protected DefaultTreeCellRenderer |
renderer
Renderer, used to get border and offsets from. |
protected Timer |
timer
Used before starting the editing session. |
protected JTree |
tree
JTree instance listening too. |
| Constructor Summary | |
|---|---|
DefaultTreeCellEditor
Constructs a DefaultTreeCellEditor
object for a JTree using the specified renderer and
a default editor. |
|
DefaultTreeCellEditor
Constructs a DefaultTreeCellEditor
object for a JTree using the
specified renderer and the specified editor. |
|
| Method Summary | |
|---|---|
void |
actionPerformed
Messaged when the timer fires, this will start the editing session. |
void |
addCellEditorListener
Adds the CellEditorListener. |
void |
cancelCellEditing
Messages cancelCellEditing to the
realEditor and removes it from this instance. |
protected boolean |
canEditImmediately
Returns true if event is null,
or it is a MouseEvent with a click count > 2
and inHitRegion returns true. |
protected Container |
createContainer
Creates the container to manage placement of editingComponent. |
protected TreeCellEditor |
createTreeCellEditor
This is invoked if a TreeCellEditor
is not supplied in the constructor. |
protected void |
determineOffset
|
Color |
getBorderSelectionColor
Returns the color the border is drawn. |
CellEditorListener |
getCellEditorListeners
Returns an array of all the CellEditorListeners added
to this DefaultTreeCellEditor with addCellEditorListener(). |
Object |
getCellEditorValue
Returns the value currently being edited. |
Font |
getFont
Gets the font used for editing. |
Component |
getTreeCellEditorComponent
Configures the editor. |
protected boolean |
inHitRegion
Returns true if the passed in location is a valid mouse location to start editing from. |
boolean |
isCellEditable
If the realEditor returns true to this
message, prepareForEditing
is messaged and true is returned. |
protected void |
prepareForEditing
Invoked just before editing is to start. |
void |
removeCellEditorListener
Removes the previously added CellEditorListener. |
void |
setBorderSelectionColor
Sets the color to use for the border. |
void |
setFont
Sets the font to edit with. |
protected void |
setTree
Sets the tree currently editing for. |
boolean |
shouldSelectCell
Messages the realEditor for the return value. |
protected boolean |
shouldStartEditingTimer
Returns true if event is a MouseEvent
and the click count is 1. |
protected void |
startEditingTimer
Starts the editing timer. |
boolean |
stopCellEditing
If the realEditor will allow editing to stop,
the realEditor is removed and true is returned,
otherwise false is returned. |
void |
valueChanged
Resets lastPath. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Field Detail |
|---|

protected TreeCellEditor![]()
![]()
realEditor

protected DefaultTreeCellRenderer![]()
![]()
renderer

protected Container![]()
![]()
editingContainer
editorComponent.

protected transient Component![]()
![]()
editingComponent
editingContainer.

protected boolean canEdit
isCellEditable.

protected transient int offset
editingComponent.

protected transient JTree![]()
![]()
tree
JTree instance listening too.

protected transient TreePath![]()
![]()
lastPath

protected transient Timer![]()
![]()
timer

protected transient int lastRow
getTreeCellEditorComponent.

protected Color![]()
![]()
borderSelectionColor

protected transient Icon![]()
![]()
editingIcon

protected Font![]()
![]()
font
null indicates
font of renderer is to be used.
| Constructor Detail |
|---|

public DefaultTreeCellEditor(JTree![]()
![]()
tree, DefaultTreeCellRenderer
![]()
![]()
renderer)
DefaultTreeCellEditor
object for a JTree using the specified renderer and
a default editor. (Use this constructor for normal editing.)
tree - a JTree objectrenderer - a DefaultTreeCellRenderer object

public DefaultTreeCellEditor(JTree![]()
![]()
tree, DefaultTreeCellRenderer
![]()
![]()
renderer, TreeCellEditor
![]()
![]()
editor)
DefaultTreeCellEditor
object for a JTree using the
specified renderer and the specified editor. (Use this constructor
for specialized editing.)
tree - a JTree objectrenderer - a DefaultTreeCellRenderer objecteditor - a TreeCellEditor object| Method Detail |
|---|

public void setBorderSelectionColor(Color![]()
![]()
newColor)
newColor - the new border color

public Color![]()
![]()
getBorderSelectionColor()

public void setFont(Font![]()
![]()
font)
null indicates
the renderers font should be used. This will NOT
override any font you have set in the editor
the receiver was instantied with. If null
for an editor was passed in a default editor will be
created that will pick up this font.
font - the editing FontgetFont()


public Font![]()
![]()
getFont()
FontsetFont(java.awt.Font)


public Component![]()
![]()
getTreeCellEditorComponent(JTree
![]()
![]()
tree, Object
![]()
![]()
value, boolean isSelected, boolean expanded, boolean leaf, int row)
realEditor.
getTreeCellEditorComponent

in interface TreeCellEditor

tree - the JTree that is asking the editor to edit;
this parameter can be nullvalue - the value of the cell to be editedisSelected - true is the cell is to be renderer with
selection highlightingexpanded - true if the node is expandedleaf - true if the node is a leaf node<