Uses of Class
javax.swing.tree.TreePath
Package
Description
Provides a set of "lightweight" (all-Java language) components
that, to the maximum degree possible, work the same on all platforms.
Provides for events fired by Swing components.
Provides one interface and many abstract classes that Swing uses to provide
its pluggable look-and-feel capabilities.
Provides user interface objects built according to the Basic look and feel.
Provides user interface objects that combine two or more look and feels.
Provides classes and interfaces for dealing with
javax.swing.JTree
.-
Uses of TreePath in javax.swing
Modifier and TypeMethodDescriptionJTree.getAnchorSelectionPath()
Returns the path identified as the anchor.JTree.getClosestPathForLocation
(int x, int y) Returns the path to the node that is closest to x,y.JTree.getEditingPath()
Returns the path to the element that is currently being edited.JTree.getLeadSelectionPath()
Returns the path identified as the lead.JTree.getNextMatch
(String prefix, int startingRow, Position.Bias bias) Returns the TreePath to the next tree element that begins with a prefix.JTree.DropLocation.getPath()
Returns the path where dropped data should be placed in the tree.protected TreePath[]
JTree.getPathBetweenRows
(int index0, int index1) Returns the paths (inclusive) between the specified rows.JTree.getPathForLocation
(int x, int y) Returns the path for the node at the specified location.JTree.getPathForRow
(int row) Returns the path for the specified row.JTree.getSelectionPath()
Returns the path to the first selected node.TreePath[]
JTree.getSelectionPaths()
Returns the paths of all selected values.Modifier and TypeMethodDescriptionprotected Enumeration<TreePath>
JTree.getDescendantToggledPaths
(TreePath parent) Returns anEnumeration
ofTreePaths
that have been expanded that are descendants ofparent
.JTree.getExpandedDescendants
(TreePath parent) Returns anEnumeration
of the descendants of the pathparent
that are currently expanded.Modifier and TypeMethodDescriptionvoid
JTree.addSelectionPath
(TreePath path) Adds the node identified by the specifiedTreePath
to the current selection.void
JTree.addSelectionPaths
(TreePath[] paths) Adds each path in the array of paths to the current selection.void
JTree.EmptySelectionModel.addSelectionPaths
(TreePath[] paths) This is overriden to do nothing;EmptySelectionModel
does not allow a selection.void
JTree.collapsePath
(TreePath path) Ensures that the node identified by the specified path is collapsed and viewable.void
JTree.expandPath
(TreePath path) Ensures that the node identified by the specified path is expanded and viewable.void
JTree.fireTreeCollapsed
(TreePath path) Notifies all listeners that have registered interest for notification on this event type.void
JTree.fireTreeExpanded
(TreePath path) Notifies all listeners that have registered interest for notification on this event type.void
JTree.fireTreeWillCollapse
(TreePath path) Notifies all listeners that have registered interest for notification on this event type.void
JTree.fireTreeWillExpand
(TreePath path) Notifies all listeners that have registered interest for notification on this event type.protected Enumeration<TreePath>
JTree.getDescendantToggledPaths
(TreePath parent) Returns anEnumeration
ofTreePaths
that have been expanded that are descendants ofparent
.JTree.getExpandedDescendants
(TreePath parent) Returns anEnumeration
of the descendants of the pathparent
that are currently expanded.JTree.getPathBounds
(TreePath path) Returns theRectangle
that the specified node will be drawn into.int
JTree.getRowForPath
(TreePath path) Returns the row that displays the node identified by the specified path.boolean
JTree.hasBeenExpanded
(TreePath path) Returns true if the node identified by the path has ever been expanded.boolean
JTree.isCollapsed
(TreePath path) Returns true if the value identified by path is currently collapsed, this will return false if any of the values in path are currently not being displayed.boolean
JTree.isExpanded
(TreePath path) Returns true if the node identified by the path is currently expanded,boolean
JTree.isPathEditable
(TreePath path) ReturnsisEditable
.boolean
JTree.isPathSelected
(TreePath path) Returns true if the item identified by the path is currently selected.boolean
Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded.void
JTree.makeVisible
(TreePath path) Ensures that the node identified by path is currently viewable.protected boolean
JTree.removeDescendantSelectedPaths
(TreePath path, boolean includePath) Removes any paths in the selection that are descendants ofpath
.void
JTree.removeSelectionPath
(TreePath path) Removes the node identified by the specified path from the current selection.void
JTree.EmptySelectionModel.removeSelectionPaths
(TreePath[] paths) This is overriden to do nothing;EmptySelectionModel
does not allow a selection.void
JTree.removeSelectionPaths
(TreePath[] paths) Removes the nodes identified by the specified paths from the current selection.void
JTree.scrollPathToVisible
(TreePath path) Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed.void
JTree.setAnchorSelectionPath
(TreePath newPath) Sets the path identified as the anchor.protected void
JTree.setExpandedState
(TreePath path, boolean state) Sets the expanded state of thisJTree
.void
JTree.setLeadSelectionPath
(TreePath newPath) Sets the path identifies as the lead.void
JTree.setSelectionPath
(TreePath path) Selects the node identified by the specified path.void
JTree.EmptySelectionModel.setSelectionPaths
(TreePath[] paths) This is overriden to do nothing;EmptySelectionModel
does not allow a selection.void
JTree.setSelectionPaths
(TreePath[] paths) Selects the nodes identified by the specified array of paths.void
JTree.startEditingAtPath
(TreePath path) Selects the node identified by the specified path and initiates editing.Modifier and TypeMethodDescriptionprotected void
JTree.removeDescendantToggledPaths
(Enumeration<TreePath> toRemove) Removes any descendants of theTreePaths
intoRemove
that have been expanded.ModifierConstructorDescriptionAccessibleJTreeNode
(JTree t, TreePath p, Accessible ap) Constructs an AccessibleJTreeNode -
Uses of TreePath in javax.swing.event
Modifier and TypeFieldDescriptionprotected TreePath
TreeSelectionEvent.newLeadSelectionPath
leadSelectionPath after the paths changed, may be null.protected TreePath
TreeSelectionEvent.oldLeadSelectionPath
leadSelectionPath before the paths changed, may be null.protected TreePath
TreeExpansionEvent.path
Path to the value this event represents.protected TreePath
TreeModelEvent.path
Path to the parent of the nodes that have changed.protected TreePath[]
TreeSelectionEvent.paths
Paths this event represents.Modifier and TypeMethodDescriptionTreeSelectionEvent.getNewLeadSelectionPath()
Returns the current lead path.TreeSelectionEvent.getOldLeadSelectionPath()
Returns the path that was previously the lead path.TreeExpansionEvent.getPath()
Returns the path to the value that has been expanded/collapsed.TreeSelectionEvent.getPath()
Returns the first path element.TreePath[]
TreeSelectionEvent.getPaths()
Returns the paths that have been added or removed from the selection.TreeModelEvent.getTreePath()
For all events, except treeStructureChanged, returns the parent of the changed nodes.Modifier and TypeMethodDescriptionboolean
TreeSelectionEvent.isAddedPath
(TreePath path) Returns whether the specified path was added to the selection.ModifierConstructorDescriptionTreeExpansionEvent
(Object source, TreePath path) Constructs a TreeExpansionEvent object.TreeModelEvent
(Object source, TreePath path) Used to create an event when the node structure has changed in some way, identifying the path to the root of the modified subtree as a TreePath object.TreeModelEvent
(Object source, TreePath path, int[] childIndices, Object[] children) Used to create an event when nodes have been changed, inserted, or removed, identifying the path to the parent of the modified items as a TreePath object.TreeSelectionEvent
(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath) Represents a change in the selection of aTreeSelectionModel
.TreeSelectionEvent
(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath) Represents a change in the selection of aTreeSelectionModel
. -
Uses of TreePath in javax.swing.plaf
Modifier and TypeMethodDescriptionabstract TreePath
TreeUI.getClosestPathForLocation
(JTree tree, int x, int y) Returns the path to the node that is closest to x,y.abstract TreePath
TreeUI.getEditingPath
(JTree tree) Returns the path to the element that is being edited.abstract TreePath
TreeUI.getPathForRow
(JTree tree, int row) Returns the path for passed in row.Modifier and TypeMethodDescriptionabstract Rectangle
TreeUI.getPathBounds
(JTree tree, TreePath path) Returns the Rectangle enclosing the label portion that the last item in path will be drawn into.abstract int
TreeUI.getRowForPath
(JTree tree, TreePath path) Returns the row that the last item identified in path is visible at.abstract void
TreeUI.startEditingAtPath
(JTree tree, TreePath path) Selects the last item in path and tries to edit it. -
Uses of TreePath in javax.swing.plaf.basic
Modifier and TypeFieldDescriptionprotected TreePath
BasicTreeUI.editingPath
Path that is being edited.Modifier and TypeFieldDescriptionBasicTreeUI.drawingCache
Used for minimizing the drawing of vertical lines.Modifier and TypeMethodDescriptionBasicTreeUI.getClosestPathForLocation
(JTree tree, int x, int y) Returns the path to the node that is closest to x,y.BasicTreeUI.getEditingPath
(JTree tree) Returns the path to the element that is being edited.protected TreePath
BasicTreeUI.getLastChildPath
(TreePath parent) Returns a path to the last child ofparent
.BasicTreeUI.getPathForRow
(JTree tree, int row) Returns the path for passed in row.Modifier and TypeMethodDescriptionprotected void
BasicTreeUI.checkForClickInExpandControl
(TreePath path, int mouseX, int mouseY) If themouseX
andmouseY
are in the expand/collapse region of therow
, this will toggle the row.protected TreePath
BasicTreeUI.getLastChildPath
(TreePath parent) Returns a path to the last child ofparent
.BasicTreeUI.getPathBounds
(JTree tree, TreePath path) Returns the Rectangle enclosing the label portion that the last item in path will be drawn into.int
BasicTreeUI.getRowForPath
(JTree tree, TreePath path) Returns the row that the last item identified in path is visible at.protected void
BasicTreeUI.handleExpandControlClick
(TreePath path, int mouseX, int mouseY) Messaged when the user clicks the particular row, this invokestoggleExpandState
.protected boolean
BasicTreeUI.isLocationInExpandControl
(TreePath path, int mouseX, int mouseY) Returnstrue
ifmouseX
andmouseY
fall in the area of row that is used to expand/collapse the node and the node atrow
does not represent a leaf.protected void
BasicTreeUI.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.protected void
BasicTreeUI.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.protected void
BasicTreeUI.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.protected void
BasicTreeUI.paintVerticalPartOfLeg
(Graphics g, Rectangle clipBounds, Insets insets, TreePath path) Paints the vertical part of the leg.protected void
BasicTreeUI.pathWasCollapsed
(TreePath path) Messaged from theVisibleTreeNode
after it has collapsed.protected void
BasicTreeUI.pathWasExpanded
(TreePath path) Messaged from theVisibleTreeNode
after it has been expanded.protected void
BasicTreeUI.selectPathForEvent
(TreePath path, MouseEvent event) Messaged to update the selection based on aMouseEvent
over a particular row.protected boolean
BasicTreeUI.shouldPaintExpandControl
(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) Returnstrue
if the expand (toggle) control should be drawn for the specified row.protected boolean
BasicTreeUI.startEditing
(TreePath path, MouseEvent event) Will start editing for node if there is acellEditor
andshouldSelectCell
returnstrue
.void
BasicTreeUI.startEditingAtPath
(JTree tree, TreePath path) Selects the last item in path and tries to edit it.protected void
BasicTreeUI.toggleExpandState
(TreePath path) Expands path if it is not expanded, or collapses row if it is expanded.protected void
BasicTreeUI.updateExpandedDescendants
(TreePath path) Updates the expanded state of all the descendants ofpath
by getting the expanded descendants from the tree and forwarding to the tree state. -
Uses of TreePath in javax.swing.plaf.multi
Modifier and TypeMethodDescriptionMultiTreeUI.getClosestPathForLocation
(JTree a, int b, int c) Invokes thegetClosestPathForLocation
method on each UI handled by this object.MultiTreeUI.getEditingPath
(JTree a) Invokes thegetEditingPath
method on each UI handled by this object.MultiTreeUI.getPathForRow
(JTree a, int b) Invokes thegetPathForRow
method on each UI handled by this object.Modifier and TypeMethodDescriptionMultiTreeUI.getPathBounds
(JTree a, TreePath b) Invokes thegetPathBounds
method on each UI handled by this object.int
MultiTreeUI.getRowForPath
(JTree a, TreePath b) Invokes thegetRowForPath
method on each UI handled by this object.void
MultiTreeUI.startEditingAtPath
(JTree a, TreePath b) Invokes thestartEditingAtPath
method on each UI handled by this object. -
Uses of TreePath in javax.swing.tree
Modifier and TypeFieldDescriptionprotected TreePath
DefaultTreeCellEditor.lastPath
Last path that was selected.protected TreePath
DefaultTreeSelectionModel.leadPath
Last path that was added.protected TreePath[]
DefaultTreeSelectionModel.selection
Paths that are currently selected.Modifier and TypeMethodDescriptionDefaultTreeSelectionModel.getLeadSelectionPath()
Returns the last path that was added.TreeSelectionModel.getLeadSelectionPath()
Returns the last path that was added.TreePath.getParentPath()
Returns theTreePath
of the parent.abstract TreePath
AbstractLayoutCache.getPathClosestTo
(int x, int y) Returns the path to the node that is closest to x,y.FixedHeightLayoutCache.getPathClosestTo
(int x, int y) Returns the path to the node that is closest to x,y.VariableHeightLayoutCache.getPathClosestTo
(int x, int y) Returns the path to the node that is closest to x,y.abstract TreePath
AbstractLayoutCache.getPathForRow
(int row) Returns the path for passed in row.FixedHeightLayoutCache.getPathForRow
(int row) Returns the path for passed in row.VariableHeightLayoutCache.getPathForRow
(int row) Returns the path forrow
.DefaultTreeSelectionModel.getSelectionPath()
Returns the first path in the selection.TreeSelectionModel.getSelectionPath()
Returns the first path in the selection.TreePath[]
DefaultTreeSelectionModel.getSelectionPaths()
Returns the selection.TreePath[]
TreeSelectionModel.getSelectionPaths()
Returns the paths in the selection.TreePath.pathByAddingChild
(Object child) Returns a new path containing all the elements of this path pluschild
.Modifier and TypeMethodDescriptionabstract Enumeration<TreePath>
AbstractLayoutCache.getVisiblePathsFrom
(TreePath path) Returns anEnumerator
that increments over the visible paths starting at the passed in location.FixedHeightLayoutCache.getVisiblePathsFrom
(TreePath path) Returns an Enumerator that increments over the visible paths starting at the passed in location.VariableHeightLayoutCache.getVisiblePathsFrom
(TreePath path) Returns anEnumerator
that increments over the visible paths starting at the passed in location.Modifier and TypeMethodDescriptionvoid
DefaultTreeSelectionModel.addSelectionPath
(TreePath path) Adds path to the current selection.void
TreeSelectionModel.addSelectionPath
(TreePath path) Adds path to the current selection.void
DefaultTreeSelectionModel.addSelectionPaths
(TreePath[] paths) Adds paths to the current selection.void
TreeSelectionModel.addSelectionPaths
(TreePath[] paths) Adds paths to the current selection.protected boolean
DefaultTreeSelectionModel.arePathsContiguous
(TreePath[] paths) Returns true if the paths are contiguous, or this object has no RowMapper.protected boolean
DefaultTreeSelectionModel.canPathsBeAdded
(TreePath[] paths) Used to test if a particular set ofTreePath
s can be added.protected boolean
DefaultTreeSelectionModel.canPathsBeRemoved
(TreePath[] paths) Returns true if the paths can be removed without breaking the continuity of the model.abstract Rectangle
Returns a rectangle giving the bounds needed to draw path.Returns a rectangle giving the bounds needed to draw path.Returns theRectangle
enclosing the label portion into which the item identified bypath
will be drawn.abstract boolean
AbstractLayoutCache.getExpandedState
(TreePath path) Returns true if the path is expanded, and visible.boolean
FixedHeightLayoutCache.getExpandedState
(TreePath path) Returns true if the path is expanded, and visible.boolean
VariableHeightLayoutCache.getExpandedState
(TreePath path) Returns true if the path is expanded, and visible.abstract int
AbstractLayoutCache.getRowForPath
(TreePath path) Returns the row that the last item identified in path is visible at.int
FixedHeightLayoutCache.getRowForPath
(TreePath path) Returns the row that the last item identified in path is visible at.int
VariableHeightLayoutCache.getRowForPath
(TreePath path) Returns the row where the last item identified in path is visible.int[]
AbstractLayoutCache.getRowsForPaths
(TreePath[] paths) Returns the rows that theTreePath
instances inpath
are being displayed at.int[]
RowMapper.getRowsForPaths
(TreePath[] path) Returns the rows that the TreePath instances inpath
are being displayed at.abstract int
AbstractLayoutCache.getVisibleChildCount
(TreePath path) Returns the number of visible children for row.int
FixedHeightLayoutCache.getVisibleChildCount
(TreePath path) Returns the number of visible children for row.int
VariableHeightLayoutCache.getVisibleChildCount
(TreePath path) Returns the number of visible children forpath
.abstract Enumeration<TreePath>
AbstractLayoutCache.getVisiblePathsFrom
(TreePath path) Returns anEnumerator
that increments over the visible paths starting at the passed in location.FixedHeightLayoutCache.getVisiblePathsFrom
(TreePath path) Returns an Enumerator that increments over the visible paths starting at the passed in location.VariableHeightLayoutCache.getVisiblePathsFrom
(TreePath path) Returns anEnumerator
that increments over the visible paths starting at the passed in location.abstract void
AbstractLayoutCache.invalidatePathBounds
(TreePath path) Instructs theLayoutCache
that the bounds forpath
are invalid, and need to be updated.void
FixedHeightLayoutCache.invalidatePathBounds
(TreePath path) Does nothing, FixedHeightLayoutCache doesn't cache width, and that is all that could change.void
VariableHeightLayoutCache.invalidatePathBounds
(TreePath path) Instructs theLayoutCache
that the bounds forpath
are invalid, and need to be updated.boolean
TreePath.isDescendant
(TreePath aTreePath) Returns true ifaTreePath
is a descendant of thisTreePath
.abstract boolean
AbstractLayoutCache.isExpanded
(TreePath path) Returns true if the value identified by row is currently expanded.boolean
FixedHeightLayoutCache.isExpanded
(TreePath path) Returns true if the value identified by row is currently expanded.boolean
VariableHeightLayoutCache.isExpanded
(TreePath path) Returns true if the value identified bypath
is currently expanded.boolean
DefaultTreeSelectionModel.isPathSelected
(TreePath path) Returns true if the path,path
, is in the current selection.boolean
TreeSelectionModel.isPathSelected
(TreePath path) Returns true if the path,path
, is in the current selection.protected void
DefaultTreeSelectionModel.notifyPathChange
(Vector<?> changedPaths, TreePath oldLeadSelection) Deprecated.As of JDK version 1.7void
DefaultTreeSelectionModel.removeSelectionPath
(TreePath path) Removes path from the selection.void
TreeSelectionModel.removeSelectionPath
(TreePath path) Removes path from the selection.void
DefaultTreeSelectionModel.removeSelectionPaths
(TreePath[] paths) Removes paths from the selection.void
TreeSelectionModel.removeSelectionPaths
(TreePath[] paths) Removes paths from the selection.abstract void
AbstractLayoutCache.setExpandedState
(TreePath path, boolean isExpanded) Marks the pathpath
expanded state toisExpanded
.void
FixedHeightLayoutCache.setExpandedState
(TreePath path, boolean isExpanded) Marks the pathpath
expanded state toisExpanded
.void
VariableHeightLayoutCache.setExpandedState
(TreePath path, boolean isExpanded) Marks the pathpath
expanded state toisExpanded
.void
DefaultTreeSelectionModel.setSelectionPath
(TreePath path) Sets the selection to path.void
TreeSelectionModel.setSelectionPath
(TreePath path) Sets the selection to path.void
DefaultTreeSelectionModel.setSelectionPaths
(TreePath[] pPaths) Sets the selection.void
TreeSelectionModel.setSelectionPaths
(TreePath[] paths) Sets the selection to path.void
DefaultTreeModel.valueForPathChanged
(TreePath path, Object newValue) This sets the user object of the TreeNode identified by path and posts a node changed.void
TreeModel.valueForPathChanged
(TreePath path, Object newValue) Messaged when the user has altered the value for the item identified bypath
tonewValue
.