Package Summary  Overview Summary

class:BasicTreeUI [NONE]

Direct Known Subclasses:
MetalTreeUI, SynthTreeUI

public class BasicTreeUI
extends TreeUI
The basic L&F for a hierarchical data structure.

field:collapsedIcon [NONE]

  • collapsedIcon

    protected transient  Icon collapsedIcon
    The collapsed icon.
  • field:expandedIcon [NONE]

    expandedIcon

    protected transient  Icon expandedIcon
    The expanded icon.

    field:leftChildIndent [NONE]

    leftChildIndent

    protected int leftChildIndent
    Distance between left margin and where vertical dashes will be drawn.

    field:rightChildIndent [NONE]

    rightChildIndent

    protected int rightChildIndent
    Distance to add to leftChildIndent to determine where cell contents will be drawn.

    field:totalChildIndent [NONE]

    totalChildIndent

    protected int totalChildIndent
    Total distance that will be indented. The sum of leftChildIndent and rightChildIndent.

    field:preferredMinSize [NONE]

    preferredMinSize

    protected Dimension preferredMinSize
    Minimum preferred size.

    field:lastSelectedRow [NONE]

    lastSelectedRow

    protected int lastSelectedRow
    Index of the row that was last selected.

    field:tree [NONE]

    tree

    protected JTree tree
    Component that we're going to be drawing into.

    field:currentCellRenderer [NONE]

    currentCellRenderer

    protected transient  TreeCellRenderer currentCellRenderer
    Renderer that is being used to do the actual cell drawing.

    field:createdRenderer [NONE]

    createdRenderer

    protected boolean createdRenderer
    Set to true if the renderer that is currently in the tree was created by this instance.

    field:cellEditor [NONE]

    cellEditor

    protected transient  TreeCellEditor cellEditor
    Editor for the tree.

    field:createdCellEditor [NONE]

    createdCellEditor

    protected boolean createdCellEditor
    Set to true if editor that is currently in the tree was created by this instance.

    field:stopEditingInCompleteEditing [NONE]

    stopEditingInCompleteEditing

    protected boolean stopEditingInCompleteEditing
    Set to false when editing and shouldSelectCell() returns true meaning the node should be selected before editing, used in completeEditing.

    field:rendererPane [NONE]

    rendererPane

    protected CellRendererPane rendererPane
    Used to paint the TreeCellRenderer.

    field:preferredSize [NONE]

    preferredSize

    protected Dimension preferredSize
    Size needed to completely display all the nodes.

    field:validCachedPreferredSize [NONE]

    validCachedPreferredSize

    protected boolean validCachedPreferredSize
    Is the preferredSize valid?

    field:treeState [NONE]

    treeState

    protected AbstractLayoutCache treeState
    Object responsible for handling sizing and expanded issues.

    field:drawingCache [NONE]

    drawingCache

    protected Hashtable<TreePath,?Boolean> drawingCache
    Used for minimizing the drawing of vertical lines.

    field:largeModel [NONE]

    largeModel

    protected boolean largeModel
    True if doing optimizations for a largeModel. Subclasses that don't support this may wish to override createLayoutCache to not return a FixedHeightLayoutCache instance.

    field:nodeDimensions [NONE]

    nodeDimensions

    protected AbstractLayoutCache.NodeDimensions nodeDimensions
    Reponsible for telling the TreeState the size needed for a node.

    field:treeModel [NONE]

    treeModel

    protected TreeModel treeModel
    Used to determine what to display.

    field:treeSelectionModel [NONE]

    treeSelectionModel

    protected TreeSelectionModel treeSelectionModel
    Model maintaining the selection.

    field:depthOffset [NONE]

    depthOffset

    protected int depthOffset
    How much the depth should be offset to properly calculate x locations. This is based on whether or not the root is visible, and if the root handles are visible.

    field:editingComponent [NONE]

    editingComponent

    protected Component editingComponent
    When editing, this will be the Component that is doing the actual editing.

    field:editingPath [NONE]

    editingPath

    protected TreePath editingPath
    Path that is being edited.

    field:editingRow [NONE]

    editingRow

    protected int editingRow
    Row that is being edited. Should only be referenced if editingComponent is not null.

    field:editorHasDifferentSize [NONE]

    editorHasDifferentSize

    protected boolean editorHasDifferentSize
    Set to true if the editor has a different size than the renderer.

    constructor:BasicTreeUI() [NONE]

    • BasicTreeUI

      public BasicTreeUI()
      Constructs a new instance of BasicTreeUI.

    method:createUI(javax.swing.JComponent) [NONE]

  • createUI

    public static  ComponentUI createUI?(JComponent x)
    Constructs a new instance of BasicTreeUI.
    Parameters:
    x - a component
    Returns:
    a new instance of BasicTreeUI
  • method:getHashColor() [NONE]

    getHashColor

    protected Color getHashColor()
    Returns the hash color.
    Returns:
    the hash color

    method:setHashColor(java.awt.Color) [NONE]

    setHashColor

    protected void setHashColor?(Color color)
    Sets the hash color.
    Parameters:
    color - the hash color

    method:setLeftChildIndent(int) [NONE]

    setLeftChildIndent

    public void setLeftChildIndent?(int newAmount)
    Sets the left child indent.
    Parameters:
    newAmount - the left child indent

    method:getLeftChildIndent() [NONE]

    getLeftChildIndent

    public int getLeftChildIndent()
    Returns the left child indent.
    Returns:
    the left child indent

    method:setRightChildIndent(int) [NONE]

    setRightChildIndent

    public void setRightChildIndent?(int newAmount)
    Sets the right child indent.
    Parameters:
    newAmount - the right child indent

    method:getRightChildIndent() [NONE]

    getRightChildIndent

    public int getRightChildIndent()
    Returns the right child indent.
    Returns:
    the right child indent

    method:setExpandedIcon(javax.swing.Icon) [NONE]

    setExpandedIcon

    public void setExpandedIcon?(Icon newG)
    Sets the expanded icon.
    Parameters:
    newG - the expanded icon

    method:getExpandedIcon() [NONE]

    getExpandedIcon

    public Icon getExpandedIcon()
    Returns the expanded icon.
    Returns:
    the expanded icon

    method:setCollapsedIcon(javax.swing.Icon) [NONE]

    setCollapsedIcon

    public void setCollapsedIcon?(Icon newG)
    Sets the collapsed icon.
    Parameters:
    newG - the collapsed icon

    method:getCollapsedIcon() [NONE]

    getCollapsedIcon

    public Icon getCollapsedIcon()
    Returns the collapsed icon.
    Returns:
    the collapsed icon

    method:setLargeModel(boolean) [CHANGED]

    setLargeModel

    protected void setLargeModel?(boolean largeModel)
    UpdatesSets the largeModel. Called when the largeModel property is changed in the componentListener, if necessarydrawn tree component.
    Parameters:
    largeModel - the new value of the largeModel property

    setLargeModel

    protected void setLargeModel?(boolean largeModel)
    Updates the componentListener, if necessary.
    Parameters:
    largeModel - the new value

    setLargeModel

    protected void setLargeModel?(boolean largeModel)
    Sets the largeModel. Called when the largeModel property is changed in the drawn tree component.
    Parameters:
    largeModel - the new value of the largeModel property

    method:isLargeModel() [NONE]

    isLargeModel

    protected boolean isLargeModel()
    Returns true if large model is set.
    Returns:
    true if large model is set

    method:setRowHeight(int) [CHANGED]

    setRowHeight

    protected void setRowHeight?(int rowHeight)
    Sets the row height, this is forwarded to the treeState. Called when the rowHeight property is changed in the drawn tree component.
    Parameters:
    rowHeight - the new value of the row heightrowHeight property

    setRowHeight

    protected void setRowHeight?(int rowHeight)
    Sets the row height, this is forwarded to the treeState.
    Parameters:
    rowHeight - the row height

    setRowHeight

    protected void setRowHeight?(int rowHeight)
    Sets the row height, this is forwarded to the treeState. Called when the rowHeight property is changed in the drawn tree component.
    Parameters:
    rowHeight - the new value of the rowHeight property

    method:getRowHeight() [CHANGED]

    getRowHeight

    protected int getRowHeight()
    Returns the height of each row in the drawn tree component. If the returned value is less than or equal to 0 the height for each row is determined by the renderer.
    Returns:
    the height of each row height, in pixels

    getRowHeight

    protected int getRowHeight()
    Returns the row height.
    Returns:
    the row height

    getRowHeight

    protected int getRowHeight()
    Returns the height of each row in the drawn tree component. If the returned value is less than or equal to 0 the height for each row is determined by the renderer.
    Returns:
    the height of each row, in pixels

    method:setCellRenderer(javax.swing.tree.TreeCellRenderer) [CHANGED]

    setCellRenderer

    protected void setCellRenderer?(TreeCellRenderer tcr)
    Sets the TreeCellRenderer to tcr. This invokes updateRenderer. Called when the cellRenderer property is changed in the drawn tree component.
    Parameters:
    tcr - the new value of the cellRenderer property

    setCellRenderer

    protected void setCellRenderer?(TreeCellRenderer tcr)
    Sets the TreeCellRenderer to tcr. This invokes updateRenderer.
    Parameters:
    tcr - the new value

    setCellRenderer

    protected void setCellRenderer?(TreeCellRenderer tcr)
    Sets the TreeCellRenderer to tcr. This invokes updateRenderer. Called when the cellRenderer property is changed in the drawn tree component.
    Parameters:
    tcr - the new value of the cellRenderer property

    method:getCellRenderer() [CHANGED]

    getCellRenderer

    protected TreeCellRenderer getCellRenderer()
    Return currentCellRenderer, which will either beReturns the current instance of the trees renderer, or defaultCellRenderer, which ever wasn't null TreeCellRenderer that is rendering each cell.
    Returns:
    anthe TreeCellRenderer instance of TreeCellRenderer

    getCellRenderer

    protected TreeCellRenderer getCellRenderer()
    Return currentCellRenderer, which will either be the trees renderer, or defaultCellRenderer, which ever wasn't null.
    Returns:
    an instance of TreeCellRenderer

    getCellRenderer

    protected TreeCellRenderer getCellRenderer()
    Returns the current instance of the TreeCellRenderer that is rendering each cell.
    Returns:
    the TreeCellRenderer instance

    method:setModel(javax.swing.tree.TreeModel) [NONE]

    setModel

    protected void setModel?(TreeModel model)
    Sets the TreeModel.
    Parameters:
    model - the new value

    method:getModel() [NONE]

    getModel

    protected TreeModel getModel()
    Returns the tree model.
    Returns:
    the tree model

    method:setRootVisible(boolean) [CHANGED]

    setRootVisible

    protected void setRootVisible?(boolean newValue)
    Sets the root to being visible. Called when the rootVisible property is changed in the drawn tree component.
    Parameters:
    newValue - the new value of the rootVisible property

    setRootVisible

    protected void setRootVisible?(boolean newValue)
    Sets the root to being visible.
    Parameters:
    newValue - the new value

    setRootVisible

    protected void setRootVisible?(boolean newValue)
    Sets the root to being visible. Called when the rootVisible property is changed in the drawn tree component.
    Parameters:
    newValue - the new value of the rootVisible property

    method:isRootVisible() [CHANGED]

    isRootVisible

    protected boolean isRootVisible()
    Returns true ifwhether the root node of the drawn tree root is visiblecomponent should be displayed.
    Returns:
    true if the root node of the tree rootis visibledisplayed

    isRootVisible

    protected boolean isRootVisible()
    Returns true if the tree root is visible.
    Returns:
    true if the tree root is visible

    isRootVisible

    protected boolean isRootVisible()
    Returns whether the root node of the drawn tree component should be displayed.
    Returns:
    true if the root node of the tree is displayed

    method:setShowsRootHandles(boolean) [CHANGED]

    setShowsRootHandles

    protected void setShowsRootHandles?(boolean newValue)
    Determines whether the node handles are to be displayed. Called when the showsRootHandles property is changed in the drawn tree component.
    Parameters:
    newValue - the new value of the showsRootHandles property

    setShowsRootHandles

    protected void setShowsRootHandles?(boolean newValue)
    Determines whether the node handles are to be displayed.
    Parameters:
    newValue - the new value

    setShowsRootHandles

    protected void setShowsRootHandles?(boolean newValue)
    Determines whether the node handles are to be displayed. Called when the showsRootHandles property is changed in the drawn tree component.
    Parameters:
    newValue - the new value of the showsRootHandles property

    method:getShowsRootHandles() [NONE]

    getShowsRootHandles

    protected boolean getShowsRootHandles()
    Returns true if the root handles are to be displayed.
    Returns:
    true if the root handles are to be displayed

    method:setCellEditor(javax.swing.tree.TreeCellEditor) [CHANGED]

    setCellEditor

    protected void setCellEditor?(TreeCellEditor editor)
    Sets the cell editor. Called when the cellEditor property is changed in the drawn tree component.
    Parameters:
    editor - the new cell editorvalue of the cellEditor property

    setCellEditor

    protected void setCellEditor?(TreeCellEditor editor)
    Sets the cell editor.
    Parameters:
    editor - the new cell editor

    setCellEditor

    protected void setCellEditor?(TreeCellEditor editor)
    Sets the cell editor. Called when the cellEditor property is changed in the drawn tree component.
    Parameters:
    editor - the new value of the cellEditor property

    method:getCellEditor() [CHANGED]

    getCellEditor

    protected TreeCellEditor getCellEditor()
    Returns an instance of TreeCellEditorthe editor used to edit entries in the drawn tree component, or null if the tree cannot be edited.
    Returns:
    anthe TreeCellEditor instance of TreeCellEditor, or null

    getCellEditor

    protected TreeCellEditor getCellEditor()
    Returns an instance of TreeCellEditor.
    Returns:
    an instance of TreeCellEditor

    getCellEditor

    protected TreeCellEditor getCellEditor()
    Returns the editor used to edit entries in the drawn tree component, or null if the tree cannot be edited.
    Returns:
    the TreeCellEditor instance, or null

    method:setEditable(boolean) [CHANGED]

    setEditable

    protected void setEditable?(boolean newValue)
    Configures the receiver to allow, or not allow, editing. Called when the editable property is changed in the drawn tree component.
    Parameters:
    newValue - the new value of the editable property

    setEditable

    protected void setEditable?(boolean newValue)
    Configures the receiver to allow, or not allow, editing.
    Parameters:
    newValue - the new value

    setEditable

    protected void setEditable?(boolean newValue)
    Configures the receiver to allow, or not allow, editing. Called when the editable property is changed in the drawn tree component.
    Parameters:
    newValue - the new value of the editable property

    method:isEditable() [CHANGED]

    isEditable

    protected boolean isEditable()
    Returns true ifwhether the drawn tree is editablecomponent should be enabled for editing.
    Returns:
    true if the tree is editable

    isEditable

    protected boolean isEditable()
    Returns true if the tree is editable.
    Returns:
    true if the tree is editable

    isEditable

    protected boolean isEditable()
    Returns whether the drawn tree component should be enabled for editing.
    Returns:
    true if the tree is editable

    method:setSelectionModel(javax.swing.tree.TreeSelectionModel) [CHANGED]

    setSelectionModel

    protected void setSelectionModel?(TreeSelectionModel newLSM)
    Resets the selection model. The appropriate listener are installed on the model. Called when the selectionModel property is changed in the drawn tree component.
    Parameters:
    newLSM - the new selection modelvalue of the selectionModel property

    setSelectionModel

    protected void setSelectionModel?(TreeSelectionModel newLSM)
    Resets the selection model. The appropriate listener are installed on the model.
    Parameters:
    newLSM - new selection model

    setSelectionModel

    protected void setSelectionModel?(TreeSelectionModel newLSM)
    Resets the selection model. The appropriate listener are installed on the model. Called when the selectionModel property is changed in the drawn tree component.
    Parameters:
    newLSM - the new value of the selectionModel property

    method:getSelectionModel() [CHANGED]

    getSelectionModel

    protected TreeSelectionModel getSelectionModel()
    Returns the tree selectioncurrent instance of the TreeSelectionModel which is the model for selections.
    Returns:
    the tree selection model TreeSelectionModel instance

    getSelectionModel

    protected TreeSelectionModel getSelectionModel()
    Returns the tree selection model.
    Returns:
    the tree selection model

    getSelectionModel

    protected TreeSelectionModel getSelectionModel()
    Returns the current instance of the TreeSelectionModel which is the model for selections.
    Returns:
    the TreeSelectionModel instance

    method:getPathBounds(javax.swing.JTree,javax.swing.tree.TreePath) [NONE]

    getPathBounds

    public Rectangle getPathBounds?(JTree tree, TreePath path)
    Returns the Rectangle enclosing the label portion that the last item in path will be drawn into. Will return null if any component in path is currently valid.
    Specified by:
    getPathBounds in class TreeUI
    Parameters:
    tree - the JTree for path
    path - the TreePath identifying the node
    Returns:
    the Rectangle enclosing the label portion that the last item in path will be drawn into, null if any component in path is currently valid.

    method:getPathForRow(javax.swing.JTree,int) [NONE]

    getPathForRow

    public TreePath getPathForRow?(JTree tree, int row)
    Returns the path for passed in row. If row is not visible null is returned.
    Specified by:
    getPathForRow in class TreeUI
    Parameters:
    tree - a JTree object
    row - an integer specifying a row
    Returns:
    the path for row or null if row is not visible

    method:getRowForPath(javax.swing.JTree,javax.swing.tree.TreePath) [NONE]

    getRowForPath

    public int getRowForPath?(JTree tree, TreePath path)
    Returns the row that the last item identified in path is visible at. Will return -1 if any of the elements in path are not currently visible.
    Specified by:
    getRowForPath in class TreeUI
    Parameters:
    tree - the JTree for path
    path - the TreePath object to look in
    Returns:
    an integer specifying the row at which the last item identified is visible, -1 if any of the elements in path are not currently visible

    method:getRowCount(javax.swing.JTree) [NONE]

    getRowCount

    public int getRowCount?(JTree tree)
    Returns the number of rows that are being displayed.
    Specified by:
    getRowCount in class TreeUI
    Parameters:
    tree - the JTree for which to count rows
    Returns:
    an integer specifying the number of row being displayed

    method:getClosestPathForLocation(javax.swing.JTree,int,int) [NONE]

    getClosestPathForLocation

    public TreePath getClosestPathForLocation?(JTree tree, int x, int y)
    Returns the path to the node that is closest to x,y. If there is nothing currently visible this will return null, otherwise it'll always return a valid path. If you need to test if the returned object is exactly at x, y you should get the bounds for the returned path and test x, y against that.
    Specified by:
    getClosestPathForLocation in class TreeUI
    Parameters:
    tree - a JTree object
    x - an integer giving the number of pixels horizontally from the left edge of the display area
    y - an integer giving the number of pixels vertically from the top of the display area, minus any top margin
    Returns:
    the TreePath node closest to x,y or null if there is nothing currently visible

    method:isEditing(javax.swing.JTree) [NONE]

    isEditing

    public boolean isEditing?(JTree tree)
    Returns true if the tree is being edited. The item that is being edited can be returned by getEditingPath().
    Specified by:
    isEditing in class TreeUI
    Parameters:
    tree - a JTree object
    Returns:
    true if tree is being edited

    method:stopEditing(javax.swing.JTree) [NONE]

    stopEditing

    public boolean stopEditing?(JTree tree)
    Stops the current editing session. This has no effect if the tree isn't being edited. Returns true if the editor allows the editing session to stop.
    Specified by:
    stopEditing in class TreeUI
    Parameters:
    tree - a JTree object
    Returns:
    true if the editor allows the editing session to stop

    method:cancelEditing(javax.swing.JTree) [NONE]

    cancelEditing

    public void cancelEditing?(JTree tree)
    Cancels the current editing session.
    Specified by:
    cancelEditing in class TreeUI
    Parameters:
    tree - a JTree object

    method:startEditingAtPath(javax.swing.JTree,javax.swing.tree.TreePath) [NONE]

    startEditingAtPath

    public void startEditingAtPath?(JTree tree, TreePath path)
    Selects the last item in path and tries to edit it. Editing will fail if the CellEditor won't allow it for the selected item.
    Specified by:
    startEditingAtPath in class TreeUI
    Parameters:
    tree - the JTree being edited
    path - the TreePath to be edited

    method:getEditingPath(javax.swing.JTree) [NONE]

    getEditingPath

    public TreePath getEditingPath?(JTree tree)
    Returns the path to the element that is being edited.
    Specified by:
    getEditingPath in class TreeUI
    Parameters:
    tree - the JTree for which to return a path
    Returns:
    a TreePath containing the path to tree

    method:installUI(javax.swing.JComponent) [NONE]

    installUI

    public void installUI?(JComponent c)
    Description copied from class: ComponentUI
    Configures the specified component appropriately for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:
    1. Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
    2. Install a LayoutManager on the component if necessary.
    3. Create/add any required sub-components to the component.
    4. Create/install event listeners on the component.
    5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
    6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
    7. Initialize any appropriate instance data.
    Overrides:
    installUI in class ComponentUI
    Parameters:
    c - the component where this UI delegate is being installed
    See Also:
    ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

    method:prepareForUIInstall() [NONE]

    prepareForUIInstall

    protected void prepareForUIInstall()
    Invoked after the tree instance variable has been set, but before any defaults/listeners have been installed.

    method:completeUIInstall() [NONE]

    completeUIInstall

    protected void completeUIInstall()
    Invoked from installUI after all the defaults/listeners have been installed.

    method:installDefaults() [NONE]

    installDefaults

    protected void installDefaults()
    Installs default properties.

    method:installListeners() [NONE]

    installListeners

    protected void installListeners()
    Registers listeners.

    method:installKeyboardActions() [NONE]

    installKeyboardActions

    protected void installKeyboardActions()
    Registers keyboard actions.

    method:installComponents() [NONE]

    installComponents

    protected void installComponents()
    Intalls the subcomponents of the tree, which is the renderer pane.

    method:createNodeDimensions() [NONE]

    createNodeDimensions

    protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
    Creates an instance of NodeDimensions that is able to determine the size of a given node in the tree.
    Returns:
    an instance of NodeDimensions

    method:createPropertyChangeListener() [NONE]

    createPropertyChangeListener

    protected PropertyChangeListener createPropertyChangeListener()
    Creates a listener that is responsible that updates the UI based on how the tree changes.
    Returns:
    an instance of the PropertyChangeListener

    method:createMouseListener() [NONE]

    createMouseListener

    protected MouseListener createMouseListener()
    Creates the listener responsible for updating the selection based on mouse events.
    Returns:
    an instance of the MouseListener

    method:createFocusListener() [NONE]

    createFocusListener

    protected FocusListener createFocusListener()
    Creates a listener that is responsible for updating the display when focus is lost/gained.
    Returns:
    an instance of the FocusListener

    method:createKeyListener() [NONE]

    createKeyListener

    protected KeyListener createKeyListener()
    Creates the listener responsible for getting key events from the tree.
    Returns:
    an instance of the KeyListener

    method:createSelectionModelPropertyChangeListener() [NONE]

    createSelectionModelPropertyChangeListener

    protected PropertyChangeListener createSelectionModelPropertyChangeListener()
    Creates the listener responsible for getting property change events from the selection model.
    Returns:
    an instance of the PropertyChangeListener

    method:createTreeSelectionListener() [NONE]

    createTreeSelectionListener

    protected TreeSelectionListener createTreeSelectionListener()
    Creates the listener that updates the display based on selection change methods.
    Returns:
    an instance of the TreeSelectionListener

    method:createCellEditorListener() [NONE]

    createCellEditorListener

    protected CellEditorListener createCellEditorListener()
    Creates a listener to handle events from the current editor.
    Returns:
    an instance of the CellEditorListener

    method:createComponentListener() [NONE]

    createComponentListener

    protected ComponentListener createComponentListener()
    Creates and returns a new ComponentHandler. This is used for the large model to mark the validCachedPreferredSize as invalid when the component moves.
    Returns:
    an instance of the ComponentListener

    method:createTreeExpansionListener() [NONE]

    createTreeExpansionListener

    protected TreeExpansionListener createTreeExpansionListener()
    Creates and returns the object responsible for updating the treestate when nodes expanded state changes.
    Returns:
    an instance of the TreeExpansionListener

    method:createLayoutCache() [NONE]

    createLayoutCache

    protected AbstractLayoutCache createLayoutCache()
    Creates the object responsible for managing what is expanded, as well as the size of nodes.
    Returns:
    the object responsible for managing what is expanded

    method:createCellRendererPane() [NONE]

    createCellRendererPane

    protected CellRendererPane createCellRendererPane()
    Returns the renderer pane that renderer components are placed in.
    Returns:
    an instance of the CellRendererPane

    method:createDefaultCellEditor() [NONE]

    createDefaultCellEditor

    protected TreeCellEditor createDefaultCellEditor()
    Creates a default cell editor.
    Returns:
    a default cell editor

    method:createDefaultCellRenderer() [NONE]

    createDefaultCellRenderer

    protected TreeCellRenderer createDefaultCellRenderer()
    Returns the default cell renderer that is used to do the stamping of each node.
    Returns:
    an instance of TreeCellRenderer

    method:createTreeModelListener() [NONE]

    createTreeModelListener

    protected TreeModelListener createTreeModelListener()
    Returns a listener that can update the tree when the model changes.
    Returns:
    an instance of the TreeModelListener.

    method:uninstallUI(javax.swing.JComponent) [NONE]

    uninstallUI

    public void uninstallUI?(JComponent c)
    Description copied from class: ComponentUI
    Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:
    1. Remove any UI-set borders from the component.
    2. Remove any UI-set layout managers on the component.
    3. Remove any UI-added sub-components from the component.
    4. Remove any UI-added event/property listeners from the component.
    5. Remove any UI-installed keyboard UI from the component.
    6. Nullify any allocated instance data objects to allow for GC.
    Overrides:
    uninstallUI in class ComponentUI
    Parameters:
    c - the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
    See Also:
    ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()

    method:prepareForUIUninstall() [NONE]

    prepareForUIUninstall

    protected void prepareForUIUninstall()
    Invoked before unstallation of UI.

    method:completeUIUninstall() [NONE]

    completeUIUninstall

    protected void completeUIUninstall()
    Uninstalls UI.

    method:uninstallDefaults() [NONE]

    uninstallDefaults

    protected void uninstallDefaults()
    Uninstalls default properties.

    method:uninstallListeners() [NONE]

    uninstallListeners

    protected void uninstallListeners()
    Unregisters listeners.

    method:uninstallKeyboardActions() [NONE]

    uninstallKeyboardActions

    protected void uninstallKeyboardActions()
    Unregisters keyboard actions.

    method:uninstallComponents() [NONE]

    uninstallComponents

    protected void uninstallComponents()
    Uninstalls the renderer pane.

    method:getBaseline(javax.swing.JComponent,int,int) [NONE]

    getBaseline

    public int getBaseline?(JComponent c, int width, int height)
    Returns the baseline.
    Overrides:
    getBaseline in class ComponentUI
    Parameters:
    c - JComponent baseline is being requested for
    width - the width to get the baseline for
    height - the height to get the baseline for
    Returns:
    baseline or a value < 0 indicating there is no reasonable baseline
    Throws:
    NullPointerException - if c is null
    IllegalArgumentException - if width or height is < 0
    Since:
    1.6
    See Also:
    JComponent.getBaseline(int, int)

    method:getBaselineResizeBehavior(javax.swing.JComponent) [NONE]

    getBaselineResizeBehavior

    public Component.BaselineResizeBehavior getBaselineResizeBehavior?(JComponent c)
    Returns an enum indicating how the baseline of the component changes as the size changes.
    Overrides:
    getBaselineResizeBehavior in class ComponentUI
    Parameters:
    c - JComponent to return baseline resize behavior for
    Returns:
    an enum indicating how the baseline changes as the component size changes
    Throws:
    NullPointerException - if c is null
    Since:
    1.6
    See Also:
    JComponent.getBaseline(int, int)

    method:paint(java.awt.Graphics,javax.swing.JComponent) [NONE]

    paint

    public void paint?(Graphics g, JComponent c)
    Description copied from class: ComponentUI
    Paints the specified component appropriately for the look and feel. This method is invoked from the ComponentUI.update method when the specified component is being painted. Subclasses should override this method and use the specified Graphics object to render the content of the component.
    Overrides:
    paint in class ComponentUI
    Parameters:
    g - the Graphics context in which to paint
    c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
    See Also:
    ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)

    method:isDropLine(javax.swing.JTree.DropLocation) [NONE]

    isDropLine

    protected boolean isDropLine?(JTree.DropLocation loc)
    Tells if a DropLocation should be indicated by a line between nodes. This is meant for javax.swing.DropMode.INSERT and javax.swing.DropMode.ON_OR_INSERT drop modes.
    Parameters:
    loc - a DropLocation
    Returns:
    true if the drop location should be shown as a line
    Since:
    1.7

    method:paintDropLine(java.awt.Graphics) [NONE]

    paintDropLine

    protected void paintDropLine?(Graphics g)
    Paints the drop line.
    Parameters:
    g - Graphics object to draw on
    Since:
    1.7

    method:getDropLineRect(javax.swing.JTree.DropLocation) [NONE]

    getDropLineRect

    protected Rectangle getDropLineRect?(JTree.DropLocation loc)
    Returns a unbounding box for the drop line.
    Parameters:
    loc - a DropLocation
    Returns:
    bounding box for the drop line
    Since:
    1.7

    method:paintHorizontalPartOfLeg(java.awt.Graphics,java.awt.Rectangle,java.awt.Insets,java.awt.Rectangle,javax.swing.tree.TreePath,int,boolean,boolean,boolean) [NONE]

    paintHorizontalPartOfLeg

    protected void paintHorizontalPartOfLeg?(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
    Paints the horizontal part of the leg. The receiver should NOT modify clipBounds, or insets.

    NOTE: parentRow can be -1 if the root is not visible.

    Parameters:
    g - a graphics context
    clipBounds - a clipped rectangle
    insets - insets
    bounds - a bounding rectangle
    path - a tree path
    row - a row
    isExpanded - true if the path is expanded
    hasBeenExpanded - true if the path has been expanded
    isLeaf - true if the path is leaf

    method:paintVerticalPartOfLeg(java.awt.Graphics,java.awt.Rectangle,java.awt.Insets,javax.swing.tree.TreePath) [NONE]

    paintVerticalPartOfLeg

    protected void paintVerticalPartOfLeg?(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
    Paints the vertical part of the leg. The receiver should NOT modify clipBounds, insets.
    Parameters:
    g - a graphics context
    clipBounds - a clipped rectangle
    insets - insets
    path - a tree path

    method:paintExpandControl(java.awt.Graphics,java.awt.Rectangle,java.awt.Insets,java.awt.Rectangle,javax.swing.tree.TreePath,int,boolean,boolean,boolean) [NONE]

    paintExpandControl

    protected void paintExpandControl?(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
    Paints the expand (toggle) part of a row. The receiver should NOT modify clipBounds, or insets.
    Parameters:
    g - a graphics context
    clipBounds - a clipped rectangle
    insets - insets
    bounds - a bounding rectangle
    path - a tree path
    row - a row
    isExpanded - true if the path is expanded
    hasBeenExpanded - true if the path has been expanded
    isLeaf - true if the row is leaf

    method:paintRow(java.awt.Graphics,java.awt.Rectangle,java.awt.Insets,java.awt.Rectangle,javax.swing.tree.TreePath,int,boolean,boolean,boolean) [NONE]

    paintRow

    protected void paintRow?(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
    Paints the renderer part of a row. The receiver should NOT modify clipBounds, or insets.
    Parameters:
    g - a graphics context
    clipBounds - a clipped rectangle
    insets - insets
    bounds - a bounding rectangle
    path - a tree path
    row - a row
    isExpanded - true if the path is expanded
    hasBeenExpanded - true if the path has been expanded
    isLeaf - true if the path is leaf

    method:shouldPaintExpandControl(javax.swing.tree.TreePath,int,boolean,boolean,boolean) [NONE]

    shouldPaintExpandControl

    protected boolean shouldPaintExpandControl?(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
    Returns true if the expand (toggle) control should be drawn for the specified row.
    Parameters:
    path - a tree path
    row - a row
    isExpanded - true if the path is expanded
    hasBeenExpanded - true if the path has been expanded
    isLeaf - true if the row is leaf
    Returns:
    true if the expand (toggle) control should be drawn for the specified row

    method:paintVerticalLine(java.awt.Graphics,javax.swing.JComponent,int,int,int) [NONE]

    paintVerticalLine

    protected void paintVerticalLine?(Graphics g, JComponent c, int x, int top, int bottom)
    Paints a vertical line.
    Parameters:
    g - a graphics context
    c - a component
    x - an X coordinate
    top - an Y1 coordinate
    bottom - an Y2 coordinate

    method:paintHorizontalLine(java.awt.Graphics,javax.swing.JComponent,int,int,int) [NONE]

    paintHorizontalLine

    protected void paintHorizontalLine?(Graphics g, JComponent c, int y, int left, int right)
    Paints a horizontal line.
    Parameters:
    g - a graphics context
    c - a component
    y - an Y coordinate
    left - an X1 coordinate
    right - an X2 coordinate

    method:getVerticalLegBuffer() [NONE]

    getVerticalLegBuffer

    protected int getVerticalLegBuffer()
    The vertical element of legs between nodes starts at the bottom of the parent node by default. This method makes the leg start below that.
    Returns:
    the vertical leg buffer

    method:getHorizontalLegBuffer() [NONE]

    getHorizontalLegBuffer

    protected int getHorizontalLegBuffer()
    The horizontal element of legs between nodes starts at the right of the left-hand side of the child node by default. This method makes the leg end before that.
    Returns:
    the horizontal leg buffer

    method:drawCentered(java.awt.Component,java.awt.Graphics,javax.swing.Icon,int,int) [NONE]

    drawCentered

    protected void drawCentered?(Component c, Graphics graphics, Icon icon, int x, int y)
    Draws the icon centered at (x,y).
    Parameters:
    c - a component
    graphics - a graphics context
    icon - an icon
    x - an X coordinate
    y - an Y coordinate

    method:drawDashedHorizontalLine(java.awt.Graphics,int,int,int) [NONE]

    drawDashedHorizontalLine

    protected void drawDashedHorizontalLine?(Graphics g, int y, int x1, int x2)
    Draws a horizontal dashed line. It is assumed x1 <= x2. If x1 is greater than x2, the method draws nothing.
    Parameters:
    g - an instance of Graphics
    y - an Y coordinate
    x1 - an X1 coordinate
    x2 - an X2 coordinate

    method:drawDashedVerticalLine(java.awt.Graphics,int,int,int) [NONE]

    drawDashedVerticalLine

    protected void drawDashedVerticalLine?(Graphics g, int x, int y1, int y2)
    Draws a vertical dashed line. It is assumed y1 <= y2. If y1 is greater than y2, the method draws nothing.
    Parameters:
    g - an instance of Graphics
    x - an X coordinate
    y1 - an Y1 coordinate
    y2 - an Y2 coordinate

    method:getRowX(int,int) [NONE]

    getRowX

    protected int getRowX?(int row, int depth)
    Returns the location, along the x-axis, to render a particular row at. The return value does not include any Insets specified on the JTree. This does not check for the validity of the row or depth, it is assumed to be correct and will not throw an Exception if the row or depth doesn't match that of the tree.
    Parameters:
    row - Row to return x location for
    depth - Depth of the row
    Returns:
    amount to indent the given row.
    Since:
    1.5

    method:updateLayoutCacheExpandedNodes() [NONE]

    updateLayoutCacheExpandedNodes

    protected void updateLayoutCacheExpandedNodes()
    Makes all the nodes that are expanded in JTree expanded in LayoutCache. This invokes updateExpandedDescendants with the root path.

    method:updateExpandedDescendants(javax.swing.tree.TreePath) [NONE]

    updateExpandedDescendants

    protected void updateExpandedDescendants?(TreePath path)
    Updates the expanded state of all the descendants of path by getting the expanded descendants from the tree and forwarding to the tree state.
    Parameters:
    path - a tree path

    method:getLastChildPath(javax.swing.tree.TreePath) [NONE]

    getLastChildPath

    protected TreePath getLastChildPath?(TreePath parent)
    Returns a path to the last child of parent.
    Parameters:
    parent - a tree path
    Returns:
    a path to the last child of parent

    method:updateDepthOffset() [NONE]

    updateDepthOffset

    protected void updateDepthOffset()
    Updates how much each depth should be offset by.

    method:updateCellEditor() [NONE]

    updateCellEditor

    protected void updateCellEditor()
    Updates the cellEditor based on the editability of the JTree that we're contained in. If the tree is editable but doesn't have a cellEditor, a basic one will be used.

    method:updateRenderer() [NONE]

    updateRenderer

    protected void updateRenderer()
    Messaged from the tree we're in when the renderer has changed.

    method:configureLayoutCache() [NONE]

    configureLayoutCache

    protected void configureLayoutCache()
    Resets the TreeState instance based on the tree we're providing the look and feel for.

    method:updateSize() [NONE]

    updateSize

    protected void updateSize()
    Marks the cached size as being invalid, and messages the tree with treeDidChange.

    method:updateCachedPreferredSize() [NONE]

    updateCachedPreferredSize

    protected void updateCachedPreferredSize()
    Updates the preferredSize instance variable, which is returned from getPreferredSize().

    For left to right orientations, the size is determined from the current AbstractLayoutCache. For RTL orientations, the preferred size becomes the width minus the minimum x position.

    method:pathWasExpanded(javax.swing.tree.TreePath) [NONE]

    pathWasExpanded

    protected void pathWasExpanded?(TreePath path)
    Messaged from the VisibleTreeNode after it has been expanded.
    Parameters:
    path - a tree path

    method:pathWasCollapsed(javax.swing.tree.TreePath) [NONE]

    pathWasCollapsed

    protected void pathWasCollapsed?(TreePath path)
    Messaged from the VisibleTreeNode after it has collapsed.
    Parameters:
    path - a tree path

    method:ensureRowsAreVisible(int,int) [NONE]

    ensureRowsAreVisible

    protected void ensureRowsAreVisible?(int beginRow, int endRow)
    Ensures that the rows identified by beginRow through endRow are visible.
    Parameters:
    beginRow - the begin row
    endRow - the end row

    method:setPreferredMinSize(java.awt.Dimension) [NONE]

    setPreferredMinSize

    public void setPreferredMinSize?(Dimension newSize)
    Sets the preferred minimum size.
    Parameters:
    newSize - the new preferred size

    method:getPreferredMinSize() [NONE]

    getPreferredMinSize

    public Dimension getPreferredMinSize()
    Returns the minimum preferred size.
    Returns:
    the minimum preferred size

    method:getPreferredSize(javax.swing.JComponent) [NONE]

    getPreferredSize

    public Dimension getPreferredSize?(JComponent c)
    Returns the preferred size to properly display the tree, this is a cover method for getPreferredSize(c, true) .
    Overrides:
    getPreferredSize in class ComponentUI
    Parameters:
    c - a component
    Returns:
    the preferred size to represent the tree in the component
    See Also:
    JComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)

    method:getPreferredSize(javax.swing.JComponent,boolean) [NONE]

    getPreferredSize

    public Dimension getPreferredSize?(JComponent c, boolean checkConsistency)
    Returns the preferred size to represent the tree in c. If checkConsistency is truecheckConsistency is messaged first.
    Parameters:
    c - a component
    checkConsistency - if true consistency is checked
    Returns:
    the preferred size to represent the tree in the component

    method:getMinimumSize(javax.swing.JComponent) [NONE]

    getMinimumSize

    public Dimension getMinimumSize?(JComponent c)
    Returns the minimum size for this component. Which will be the min preferred size or 0, 0.
    Overrides:
    getMinimumSize in class ComponentUI
    Parameters:
    c - the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
    Returns:
    a Dimension object or null
    See Also:
    JComponent.getMinimumSize(), LayoutManager.minimumLayoutSize(java.awt.Container), ComponentUI.getPreferredSize(javax.swing.JComponent)

    method:getMaximumSize(javax.swing.JComponent) [NONE]

    getMaximumSize

    public Dimension getMaximumSize?(JComponent c)
    Returns the maximum size for this component, which will be the preferred size if the instance is currently in a JTree, or 0, 0.
    Overrides:
    getMaximumSize in class ComponentUI
    Parameters:
    c - the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
    Returns:
    a Dimension object or null
    See Also:
    JComponent.getMaximumSize(), LayoutManager2.maximumLayoutSize(java.awt.Container)

    method:completeEditing() [NONE]

    completeEditing

    protected void completeEditing()
    Messages to stop the editing session. If the UI the receiver is providing the look and feel for returns true from getInvokesStopCellEditing, stopCellEditing will invoked on the current editor. Then completeEditing will be messaged with false, true, false to cancel any lingering editing.

    method:completeEditing(boolean,boolean,boolean) [NONE]

    completeEditing

    protected void completeEditing?(boolean messageStop, boolean messageCancel, boolean messageTree)
    Stops the editing session. If messageStop is true the editor is messaged with stopEditing, if messageCancel is true the editor is messaged with cancelEditing. If messageTree is true the treeModel is messaged with valueForPathChanged.
    Parameters:
    messageStop - message to stop editing
    messageCancel - message to cancel editing
    messageTree - message to tree

    method:startEditing(javax.swing.tree.TreePath,java.awt.event.MouseEvent) [NONE]

    startEditing

    protected boolean startEditing?(TreePath path, MouseEvent event)
    Will start editing for node if there is a cellEditor and shouldSelectCell returns true.

    This assumes that path is valid and visible.

    Parameters:
    path - a tree path
    event - a mouse event
    Returns:
    true if the editing is successful

    method:checkForClickInExpandControl(javax.swing.tree.TreePath,int,int) [NONE]

    checkForClickInExpandControl

    protected void checkForClickInExpandControl?(TreePath path, int mouseX, int mouseY)
    If the mouseX and mouseY are in the expand/collapse region of the row, this will toggle the row.
    Parameters:
    path - a tree path
    mouseX - an X coordinate
    mouseY - an Y coordinate

    method:isLocationInExpandControl(javax.swing.tree.TreePath,int,int) [NONE]

    isLocationInExpandControl

    protected boolean isLocationInExpandControl?(TreePath path, int mouseX, int mouseY)
    Returns true if mouseX and mouseY fall in the area of row that is used to expand/collapse the node and the node at row does not represent a leaf.
    Parameters:
    path - a tree path
    mouseX - an X coordinate
    mouseY - an Y coordinate
    Returns:
    true if the mouse cursor fall in the area of row that is used to expand/collapse the node and the node is not a leaf.

    method:handleExpandControlClick(javax.swing.tree.TreePath,int,int) [NONE]

    handleExpandControlClick

    protected void handleExpandControlClick?(TreePath path, int mouseX, int mouseY)
    Messaged when the user clicks the particular row, this invokes toggleExpandState.
    Parameters:
    path - a tree path
    mouseX - an X coordinate
    mouseY - an Y coordinate

    method:toggleExpandState(javax.swing.tree.TreePath) [NONE]

    toggleExpandState

    protected void toggleExpandState?(TreePath path)
    Expands path if it is not expanded, or collapses row if it is expanded. If expanding a path and JTree scrolls on expand, ensureRowsAreVisible is invoked to scroll as many of the children to visible as possible (tries to scroll to last visible descendant of path).
    Parameters:
    path - a tree path

    method:isToggleSelectionEvent(java.awt.event.MouseEvent) [NONE]

    isToggleSelectionEvent

    protected boolean isToggleSelectionEvent?(MouseEvent event)
    Returning true signifies a mouse event on the node should toggle the selection of only the row under mouse.
    Parameters:
    event - a mouse event
    Returns:
    true if a mouse event on the node should toggle the selection

    method:isMultiSelectEvent(java.awt.event.MouseEvent) [NONE]

    isMultiSelectEvent

    protected boolean isMultiSelectEvent?(MouseEvent event)
    Returning true signifies a mouse event on the node should select from the anchor point.
    Parameters:
    event - a mouse event
    Returns:
    true if a mouse event on the node should select from the anchor point

    method:isToggleEvent(java.awt.event.MouseEvent) [NONE]

    isToggleEvent

    protected boolean isToggleEvent?(MouseEvent event)
    Returning true indicates the row under the mouse should be toggled based on the event. This is invoked after checkForClickInExpandControl, implying the location is not in the expand (toggle) control.
    Parameters:
    event - a mouse event
    Returns:
    true if the row under the mouse should be toggled

    method:selectPathForEvent(javax.swing.tree.TreePath,java.awt.event.MouseEvent) [NONE]

    selectPathForEvent

    protected void selectPathForEvent?(TreePath path, MouseEvent event)
    Messaged to update the selection based on a MouseEvent over a particular row. If the event is a toggle selection event, the row is either selected, or deselected. If the event identifies a multi selection event, the selection is updated from the anchor point. Otherwise the row is selected, and if the event specified a toggle event the row is expanded/collapsed.
    Parameters:
    path - the selected path
    event - the mouse event

    method:isLeaf(int) [NONE]

    isLeaf

    protected boolean isLeaf?(int row)
    Returns true if the node at row is a leaf.
    Parameters:
    row - a row
    Returns:
    true if the node at row is a leaf

    method:updateLeadSelectionRow() [NONE]

    updateLeadSelectionRow

    protected void updateLeadSelectionRow()
    Updates the lead row of the selection.
    Since:
    1.7

    method:getLeadSelectionRow() [NONE]

    getLeadSelectionRow

    protected int getLeadSelectionRow()
    Returns the lead row of the selection.
    Returns:
    selection lead row
    Since:
    1.7

    © 2020 Oracle Corporation and/or its affiliates