Package Summary  Overview Summary

class:DefaultTreeCellEditor [NONE]

  • All Implemented Interfaces:
    ActionListener, EventListener, CellEditor, TreeSelectionListener, TreeCellEditor


    public class DefaultTreeCellEditor
    extends Object
    implements ActionListener, 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 milliseconds.

    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 JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

    See Also:
    JTree

field:realEditor [NONE]

  • realEditor

    protected TreeCellEditor realEditor
    Editor handling the editing.

field:renderer [NONE]

field:editingContainer [NONE]

  • editingContainer

    protected Container editingContainer
    Editing container, will contain the editorComponent.

field:editingComponent [NONE]

  • editingComponent

    protected transient Component editingComponent
    Component used in editing, obtained from the editingContainer.

field:canEdit [NONE]

  • canEdit

    protected boolean canEdit
    As of Java 2 platform v1.4 this field should no longer be used. If you wish to provide similar behavior you should directly override isCellEditable.

field:offset [NONE]

  • offset

    protected transient int offset
    Used in editing. Indicates x position to place editingComponent.

field:tree [NONE]

  • tree

    protected transient JTree tree
    JTree instance listening too.

field:lastPath [NONE]

  • lastPath

    protected transient TreePath lastPath
    Last path that was selected.

field:timer [NONE]

  • timer

    protected transient Timer timer
    Used before starting the editing session.

field:lastRow [NONE]

  • lastRow

    protected transient int lastRow
    Row that was last passed into getTreeCellEditorComponent.

field:borderSelectionColor [NONE]

  • borderSelectionColor

    protected Color borderSelectionColor
    True if the border selection color should be drawn.

field:editingIcon [NONE]

  • editingIcon

    protected transient Icon editingIcon
    Icon to use when editing.

field:font [NONE]

  • font

    protected Font font
    Font to paint with, null indicates font of renderer is to be used.

constructor:DefaultTreeCellEditor(javax.swing.JTree, javax.swing.tree.DefaultTreeCellRenderer) [CHANGED]

  • DefaultTreeCellEditor

    public DefaultTreeCellEditorpublic DefaultTreeCellEditor​(JTree tree,
                                 DefaultTreeCellRenderer renderer)
    Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and a default editor. (Use this constructor for normal editing.)
    Parameters:
    tree - a JTree object
    renderer - a DefaultTreeCellRenderer object
  • DefaultTreeCellEditor

    public DefaultTreeCellEditor(JTree tree,
                                 DefaultTreeCellRenderer renderer)
    Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and a default editor. (Use this constructor for normal editing.)
    Parameters:
    tree - a JTree object
    renderer - a DefaultTreeCellRenderer object
  • DefaultTreeCellEditor

    public DefaultTreeCellEditor​(JTree tree,
                                 DefaultTreeCellRenderer renderer)
    Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and a default editor. (Use this constructor for normal editing.)
    Parameters:
    tree - a JTree object
    renderer - a DefaultTreeCellRenderer object

constructor:DefaultTreeCellEditor(javax.swing.JTree, javax.swing.tree.DefaultTreeCellRenderer, javax.swing.tree.TreeCellEditor) [CHANGED]

  • DefaultTreeCellEditor

    public DefaultTreeCellEditorpublic DefaultTreeCellEditor​(JTree tree,
                                 DefaultTreeCellRenderer renderer,
                                 TreeCellEditor editor)
    Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and the specified editor. (Use this constructor for specialized editing.)
    Parameters:
    tree - a JTree object
    renderer - a DefaultTreeCellRenderer object
    editor - a TreeCellEditor object
  • DefaultTreeCellEditor

    public DefaultTreeCellEditor(JTree tree,
                                 DefaultTreeCellRenderer renderer,
                                 TreeCellEditor editor)
    Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and the specified editor. (Use this constructor for specialized editing.)
    Parameters:
    tree - a JTree object
    renderer - a DefaultTreeCellRenderer object
    editor - a TreeCellEditor object
  • DefaultTreeCellEditor

    public DefaultTreeCellEditor​(JTree tree,
                                 DefaultTreeCellRenderer renderer,
                                 TreeCellEditor editor)
    Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and the specified editor. (Use this constructor for specialized editing.)
    Parameters:
    tree - a JTree object
    renderer - a DefaultTreeCellRenderer object
    editor - a TreeCellEditor object

method:setBorderSelectionColor(java.awt.Color) [CHANGED]

  • setBorderSelectionColor

    public void setBorderSelectionColorpublic void setBorderSelectionColor​(Color newColor)
    Sets the color to use for the border.
    Parameters:
    newColor - the new border color
  • setBorderSelectionColor

    public void setBorderSelectionColor(Color newColor)
    Sets the color to use for the border.
    Parameters:
    newColor - the new border color
  • setBorderSelectionColor

    public void setBorderSelectionColor​(Color newColor)
    Sets the color to use for the border.
    Parameters:
    newColor - the new border color

method:getBorderSelectionColor() [CHANGED]

  • getBorderSelectionColor

    public Color getBorderSelectionColor getBorderSelectionColor​()
    Returns the color the border is drawn.
    Returns:
    the border selection color
  • getBorderSelectionColor

    public Color getBorderSelectionColor()
    Returns the color the border is drawn.
    Returns:
    the border selection color
  • getBorderSelectionColor

    public Color getBorderSelectionColor​()
    Returns the color the border is drawn.
    Returns:
    the border selection color

method:setFont(java.awt.Font) [CHANGED]

  • setFont

    public void setFontpublic void setFont​(Font font)
    Sets the font to edit with. null indicates the renderers font should be used. This will NOT override any font you have set in the editor the receiver was instantiated with. If null for an editor was passed in a default editor will be created that will pick up this font.
    Parameters:
    font - the editing Font
    See Also:
    getFont()
  • setFont

    public void setFont(Font font)
    Sets the font to edit with. null indicates the renderers font should be used. This will NOT override any font you have set in the editor the receiver was instantiated with. If null for an editor was passed in a default editor will be created that will pick up this font.
    Parameters:
    font - the editing Font
    See Also:
    getFont()
  • setFont

    public void setFont​(Font font)
    Sets the font to edit with. null indicates the renderers font should be used. This will NOT override any font you have set in the editor the receiver was instantiated with. If null for an editor was passed in a default editor will be created that will pick up this font.
    Parameters:
    font - the editing Font
    See Also:
    getFont()

method:getFont() [CHANGED]

  • getFont

    public Font getFont getFont​()
    Gets the font used for editing.
    Returns:
    the editing Font
    See Also:
    setFont(java.awt.Font)

method:getTreeCellEditorComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) [CHANGED]

  • getTreeCellEditorComponent

    public Component getTreeCellEditorComponent getTreeCellEditorComponent​(JTree tree,
                                                Object value,
                                                boolean isSelected,
                                                boolean expanded,
                                                boolean leaf,
                                                int row)
    Configures the editor. Passed onto the realEditor.
    Specified by:
    getTreeCellEditorComponent in interface 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 if the cell is to be rendered 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
  • getTreeCellEditorComponent

    public Component getTreeCellEditorComponent(JTree tree,
                                                Object value,
                                                boolean isSelected,
                                                boolean expanded,
                                                boolean leaf,
                                                int row)
    Configures the editor. Passed onto the realEditor.
    Specified by:
    getTreeCellEditorComponent in interface 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 if the cell is to be rendered 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
  • getTreeCellEditorComponent

    public Component getTreeCellEditorComponent​(JTree tree,
                                                Object value,
                                                boolean isSelected,
                                                boolean expanded,
                                                boolean leaf,
                                                int row)
    Configures the editor. Passed onto the realEditor.
    Specified by:
    getTreeCellEditorComponent in interface 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 if the cell is to be rendered 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

method:getCellEditorValue() [CHANGED]

  • getCellEditorValue

    public Object getCellEditorValue getCellEditorValue​()
    Returns the value currently being edited.
    Specified by:
    getCellEditorValue in interface CellEditor
    Returns:
    the value currently being edited
  • getCellEditorValue

    public Object getCellEditorValue()
    Returns the value currently being edited.
    Specified by:
    getCellEditorValue in interface CellEditor
    Returns:
    the value currently being edited
  • getCellEditorValue

    public Object getCellEditorValue​()
    Returns the value currently being edited.
    Specified by:
    getCellEditorValue in interface CellEditor
    Returns:
    the value currently being edited

method:isCellEditable(java.util.EventObject) [CHANGED]

  • isCellEditable

    public boolean isCellEditablepublic boolean isCellEditable​(EventObject event)
    If the realEditor returns true to this message, prepareForEditing is messaged and true is returned.
    Specified by:
    isCellEditable in interface CellEditor
    Parameters:
    event - the event the editor should use to consider whether to begin editing or not
    Returns:
    true if editing can be started
    See Also:
    CellEditor.shouldSelectCell(java.util.EventObject)

method:shouldSelectCell(java.util.EventObject) [CHANGED]

  • shouldSelectCell

    public boolean shouldSelectCellpublic boolean shouldSelectCell​(EventObject event)
    Messages the realEditor for the return value.
    Specified by:
    shouldSelectCell in interface CellEditor
    Parameters:
    event - the event the editor should use to start editing
    Returns:
    true if the editor would like the editing cell to be selected; otherwise returns false
    See Also:
    CellEditor.isCellEditable(java.util.EventObject)

method:stopCellEditing() [CHANGED]

  • stopCellEditing

    public boolean stopCellEditingpublic boolean stopCellEditing​()
    If the realEditor will allow editing to stop, the realEditor is removed and true is returned, otherwise false is returned.
    Specified by:
    stopCellEditing in interface CellEditor
    Returns:
    true if editing was stopped; false otherwise
  • stopCellEditing

    public boolean stopCellEditing()
    If the realEditor will allow editing to stop, the realEditor is removed and true is returned, otherwise false is returned.
    Specified by:
    stopCellEditing in interface CellEditor
    Returns:
    true if editing was stopped; false otherwise
  • stopCellEditing

    public boolean stopCellEditing​()
    If the realEditor will allow editing to stop, the realEditor is removed and true is returned, otherwise false is returned.
    Specified by:
    stopCellEditing in interface CellEditor
    Returns:
    true if editing was stopped; false otherwise

method:cancelCellEditing() [CHANGED]

  • cancelCellEditing

    public void cancelCellEditingpublic void cancelCellEditing​()
    Messages cancelCellEditing to the realEditor and removes it from this instance.
    Specified by:
    cancelCellEditing in interface CellEditor
  • cancelCellEditing

    public void cancelCellEditing()
    Messages cancelCellEditing to the realEditor and removes it from this instance.
    Specified by:
    cancelCellEditing in interface CellEditor
  • cancelCellEditing

    public void cancelCellEditing​()
    Messages cancelCellEditing to the realEditor and removes it from this instance.
    Specified by:
    cancelCellEditing in interface CellEditor

method:addCellEditorListener(javax.swing.event.CellEditorListener) [CHANGED]

  • addCellEditorListener

    public void addCellEditorListenerpublic void addCellEditorListener​(CellEditorListener l)
    Adds the CellEditorListener.
    Specified by:
    addCellEditorListener in interface CellEditor
    Parameters:
    l - the listener to be added

method:removeCellEditorListener(javax.swing.event.CellEditorListener) [CHANGED]

  • removeCellEditorListener

    public void removeCellEditorListenerpublic void removeCellEditorListener​(CellEditorListener l)
    Removes the previously added CellEditorListener.
    Specified by:
    removeCellEditorListener in interface CellEditor
    Parameters:
    l - the listener to be removed

method:getCellEditorListeners() [CHANGED]

  • getCellEditorListeners

    public CellEditorListener[] getCellEditorListeners getCellEditorListeners​()
    Returns an array of all the CellEditorListeners added to this DefaultTreeCellEditor with addCellEditorListener().
    Returns:
    all of the CellEditorListeners added or an empty array if no listeners have been added
    Since:
    1.4
  • getCellEditorListeners

    public CellEditorListener[] getCellEditorListeners()
    Returns an array of all the CellEditorListeners added to this DefaultTreeCellEditor with addCellEditorListener().
    Returns:
    all of the CellEditorListeners added or an empty array if no listeners have been added
    Since:
    1.4
  • getCellEditorListeners

    public CellEditorListener[] getCellEditorListeners​()
    Returns an array of all the CellEditorListeners added to this DefaultTreeCellEditor with addCellEditorListener().
    Returns:
    all of the CellEditorListeners added or an empty array if no listeners have been added
    Since:
    1.4

method:valueChanged(javax.swing.event.TreeSelectionEvent) [CHANGED]

method:actionPerformed(java.awt.event.ActionEvent) [CHANGED]

  • actionPerformed

    public void actionPerformedpublic void actionPerformed​(ActionEvent e)
    Messaged when the timer fires, this will start the editing session.
    Specified by:
    actionPerformed in interface ActionListener
    Parameters:
    e - the event to be processed
  • actionPerformed

    public void actionPerformed​(ActionEvent e)
    Messaged when the timer fires, this will start the editing session.
    Specified by:
    actionPerformed in interface ActionListener
    Parameters:
    e - the event to be processed

method:setTree(javax.swing.JTree) [CHANGED]

  • setTree

    protected void setTreeprotected void setTree​(JTree newTree)
    Sets the tree currently editing for. This is needed to add a selection listener.
    Parameters:
    newTree - the new tree to be edited
  • setTree

    protected void setTree(JTree newTree)
    Sets the tree currently editing for. This is needed to add a selection listener.
    Parameters:
    newTree - the new tree to be edited
  • setTree

    protected void setTree​(JTree newTree)
    Sets the tree currently editing for. This is needed to add a selection listener.
    Parameters:
    newTree - the new tree to be edited

method:shouldStartEditingTimer(java.util.EventObject) [CHANGED]

  • shouldStartEditingTimer

    protected boolean shouldStartEditingTimerprotected boolean shouldStartEditingTimer​(EventObject event)
    Returns true if event is a MouseEvent and the click count is 1.
    Parameters:
    event - the event being studied
    Returns:
    whether event should starts the editing timer
  • shouldStartEditingTimer

    protected boolean shouldStartEditingTimer(EventObject event)
    Returns true if event is a MouseEvent and the click count is 1.
    Parameters:
    event - the event being studied
  • shouldStartEditingTimer

    protected boolean shouldStartEditingTimer​(EventObject event)
    Returns true if event is a MouseEvent and the click count is 1.
    Parameters:
    event - the event being studied
    Returns:
    whether event should starts the editing timer

method:startEditingTimer() [CHANGED]

  • startEditingTimer

    protected void startEditingTimerprotected void startEditingTimer​()
    Starts the editing timer.
  • startEditingTimer

    protected void startEditingTimer()
    Starts the editing timer.
  • startEditingTimer

    protected void startEditingTimer​()
    Starts the editing timer.

method:canEditImmediately(java.util.EventObject) [CHANGED]

  • canEditImmediately

    protected boolean canEditImmediatelyprotected boolean canEditImmediately​(EventObject event)
    Returns true if event is null, or it is a MouseEvent with a click count > 2 and inHitRegion returns true.
    Parameters:
    event - the event being studied
    Returns:
    whether editing can be started for the given event
  • canEditImmediately

    protected boolean canEditImmediately(EventObject event)
    Returns true if event is null, or it is a MouseEvent with a click count > 2 and inHitRegion returns true.
    Parameters:
    event - the event being studied
  • canEditImmediately

    protected boolean canEditImmediately​(EventObject event)
    Returns true if event is null, or it is a MouseEvent with a click count > 2 and inHitRegion returns true.
    Parameters:
    event - the event being studied
    Returns:
    whether editing can be started for the given event

method:inHitRegion(int, int) [CHANGED]

  • inHitRegion

    protected boolean inHitRegionprotected boolean inHitRegion​(int x,
                                  int y)
    Returns true if the passed in location is a valid mouse location to start editing from. This is implemented to return false if x is <= the width of the icon and icon gap displayed by the renderer. In other words this returns true if the user clicks over the text part displayed by the renderer, and false otherwise.
    Parameters:
    x - the x-coordinate of the point
    y - the y-coordinate of the point
    Returns:
    true if the passed in location is a valid mouse location
  • inHitRegion

    protected boolean inHitRegion(int x,
                                  int y)
    Returns true if the passed in location is a valid mouse location to start editing from. This is implemented to return false if x is <= the width of the icon and icon gap displayed by the renderer. In other words this returns true if the user clicks over the text part displayed by the renderer, and false otherwise.
    Parameters:
    x - the x-coordinate of the point
    y - the y-coordinate of the point
    Returns:
    true if the passed in location is a valid mouse location
  • inHitRegion

    protected boolean inHitRegion​(int x,
                                  int y)
    Returns true if the passed in location is a valid mouse location to start editing from. This is implemented to return false if x is <= the width of the icon and icon gap displayed by the renderer. In other words this returns true if the user clicks over the text part displayed by the renderer, and false otherwise.
    Parameters:
    x - the x-coordinate of the point
    y - the y-coordinate of the point
    Returns:
    true if the passed in location is a valid mouse location

method:determineOffset(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int) [CHANGED]

  • determineOffset

    protected void determineOffsetprotected void determineOffset​(JTree tree,
                                   Object value,
                                   boolean isSelected,
                                   boolean expanded,
                                   boolean leaf,
                                   int row)
    Determine the offset.
    Parameters:
    tree - a JTree object
    value - a value
    isSelected - selection status
    expanded - expansion status
    leaf - leaf status
    row - current row
  • determineOffset

    protected void determineOffset(JTree tree,
                                   Object value,
                                   boolean isSelected,
                                   boolean expanded,
                                   boolean leaf,
                                   int row)
  • determineOffset

    protected void determineOffset​(JTree tree,
                                   Object value,
                                   boolean isSelected,
                                   boolean expanded,
                                   boolean leaf,
                                   int row)
    Determine the offset.
    Parameters:
    tree - a JTree object
    value - a value
    isSelected - selection status
    expanded - expansion status
    leaf - leaf status
    row - current row

method:prepareForEditing() [CHANGED]

  • prepareForEditing

    protected void prepareForEditingprotected void prepareForEditing​()
    Invoked just before editing is to start. Will add the editingComponent to the editingContainer.
  • prepareForEditing

    protected void prepareForEditing()
    Invoked just before editing is to start. Will add the editingComponent to the editingContainer.
  • prepareForEditing

    protected void prepareForEditing​()
    Invoked just before editing is to start. Will add the editingComponent to the editingContainer.

method:createContainer() [CHANGED]

  • createContainer

    protected Container createContainer createContainer​()
    Creates the container to manage placement of editingComponent.
    Returns:
    new Container object
  • createContainer

    protected Container createContainer()
    Creates the container to manage placement of editingComponent.
  • createContainer

    protected Container createContainer​()
    Creates the container to manage placement of editingComponent.
    Returns:
    new Container object

method:createTreeCellEditor() [CHANGED]

  • createTreeCellEditor

    protected TreeCellEditor createTreeCellEditor createTreeCellEditor​()
    This is invoked if a TreeCellEditor is not supplied in the constructor. It returns a TextField editor.
    Returns:
    a new TextField editor
  • createTreeCellEditor

    protected TreeCellEditor createTreeCellEditor()
    This is invoked if a TreeCellEditor is not supplied in the constructor. It returns a TextField editor.
    Returns:
    a new TextField editor
  • createTreeCellEditor

    protected TreeCellEditor createTreeCellEditor​()
    This is invoked if a TreeCellEditor is not supplied in the constructor. It returns a TextField editor.
    Returns:
    a new TextField editor

© 2017 Oracle Corporation and/or its affiliates