APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.tree

public Class DefaultTreeSelectionModel

Additional top-level class in compilation unit: PathPlaceHolder.

extends Object
implements Cloneable, Serializable, TreeSelectionModel
Class Inheritance
All Implemented Interfaces
javax.swing.tree.TreeSelectionModel, java.io.Serializable, java.lang.Cloneable
Known Direct Subclasses
javax.swing.JTree.EmptySelectionModel
Annotations
@SuppressWarnings:serial
Imports
java.beans.PropertyChangeListener, java.io.IOException, .InvalidObjectException, .ObjectInputStream, .ObjectOutputStream, .Serial, .Serializable, java.util.ArrayList, .BitSet, .Enumeration, .EventListener, .Hashtable, .List, .Vector, javax.swing.DefaultListSelectionModel, javax.swing.event.EventListenerList, .SwingPropertyChangeSupport, .TreeSelectionEvent, .TreeSelectionListener

Default implementation of TreeSelectionModel. Listeners are notified whenever the paths in the selection change, not the rows. In order to be able to track row changes you may wish to become a listener for expansion events on the tree and test for changes from there.

resetRowSelection is called from any of the methods that update the selected paths. If you subclass any of these methods to filter what is allowed to be selected, be sure and message resetRowSelection if you do not message super

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 java.beans.XMLEncoder.

Author
Scott Violet
See Also
javax.swing.JTree

Field Summary

Modifier and TypeField and Description
protected SwingPropertyChangeSupport
changeSupport

Used to messaged registered listeners.

private Hashtable<TreePath, Boolean>
protected int
leadIndex

Index of the lead path in selection.

protected TreePath
leadPath

Last path that was added.

protected int
leadRow

Lead row.

protected EventListenerList
listenerList

Event listener list.

protected DefaultListSelectionModel
listSelectionModel

Handles maintaining the list selection model.

protected transient RowMapper
rowMapper

Provides a row for a given path.

protected TreePath[]
selection

Paths that are currently selected.

public static final String
SELECTION_MODE_PROPERTY

Property name for selectionMode.

protected int
selectionMode

Mode for the selection, will be either SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.

private TreePath[]
private Hashtable<TreePath, Boolean>
uniquePaths

Used to make sure the paths are unique, will contain all the paths in selection.

Constructor Summary

AccessConstructor and Description
public
DefaultTreeSelectionModel()

Creates a new instance of DefaultTreeSelectionModel that is empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addPropertyChangeListener(PropertyChangeListener
the PropertyChangeListener to be added
listener
)

Implements javax.swing.tree.TreeSelectionModel.addPropertyChangeListener.

Adds a PropertyChangeListener to the listener list.

public void
addSelectionPath(TreePath
the new path to add to the current selection
path
)

Implements javax.swing.tree.TreeSelectionModel.addSelectionPath.

Adds path to the current selection.

public void
addSelectionPaths(TreePath[]
the new path to add to the current selection
paths
)

Implements javax.swing.tree.TreeSelectionModel.addSelectionPaths.

Adds paths to the current selection.

public void
addTreeSelectionListener(TreeSelectionListener
the new listener to be added
x
)

Implements javax.swing.tree.TreeSelectionModel.addTreeSelectionListener.

Adds x to the list of listeners that are notified each time the set of selected TreePaths changes.

protected boolean

Returns:

whether the paths are contiguous, or this object has no RowMapper
arePathsContiguous
(TreePath[]
array of paths to check
paths
)

Returns true if the paths are contiguous, or this object has no RowMapper.

protected boolean

Returns:

whether the particular set of TreePaths can be added
canPathsBeAdded
(TreePath[]
array of TreePaths to check
paths
)

Used to test if a particular set of TreePaths can be added.

protected boolean

Returns:

whether the paths can be removed without breaking the continuity of the model
canPathsBeRemoved
(TreePath[]
array of TreePath to check
paths
)

Returns true if the paths can be removed without breaking the continuity of the model.

public void
clearSelection()

Implements javax.swing.tree.TreeSelectionModel.clearSelection.

Empties the current selection.

public Object
clone()

Overrides java.lang.Object.clone.

Returns a clone of this object with the same selection.

protected void
fireValueChanged(TreeSelectionEvent
the event that characterizes the change
e
)

Notifies all listeners that are registered for tree selection events on this object.

public TreePath
getLeadSelectionPath()

Implements javax.swing.tree.TreeSelectionModel.getLeadSelectionPath.

Returns the last path that was added.

public int
public <
the listener type
T extends EventListener
>
T[]

Returns:

an array of all objects registered as FooListeners on this component, or an empty array if no such listeners have been added
getListeners
(Class<T>
the type of listeners requested
listenerType
)

Returns an array of all the objects currently registered as FooListeners upon this model.

public int
getMaxSelectionRow()

Implements javax.swing.tree.TreeSelectionModel.getMaxSelectionRow.

Returns the largest value obtained from the RowMapper for the current set of selected TreePaths.

public int
getMinSelectionRow()

Implements javax.swing.tree.TreeSelectionModel.getMinSelectionRow.

Returns the smallest value obtained from the RowMapper for the current set of selected TreePaths.

public PropertyChangeListener[]

Returns:

all of this model's PropertyChangeListeners or an empty array if no property change listeners are currently registered
getPropertyChangeListeners
()

Returns an array of all the property change listeners registered on this DefaultTreeSelectionModel.

public RowMapper
getRowMapper()

Implements javax.swing.tree.TreeSelectionModel.getRowMapper.

Returns the RowMapper instance that is able to map a TreePath to a row.

public int
getSelectionCount()

Implements javax.swing.tree.TreeSelectionModel.getSelectionCount.

Returns the number of paths that are selected.

public int
getSelectionMode()

Implements javax.swing.tree.TreeSelectionModel.getSelectionMode.

Returns the selection mode, one of SINGLE_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION or CONTIGUOUS_TREE_SELECTION.

public TreePath
getSelectionPath()

Implements javax.swing.tree.TreeSelectionModel.getSelectionPath.

Returns the first path in the selection.

public TreePath[]

Returns:

the selection
getSelectionPaths
()

Implements javax.swing.tree.TreeSelectionModel.getSelectionPaths.

Returns the selection.

public int[]

Returns:

the selection in terms of rows
getSelectionRows
()

Implements javax.swing.tree.TreeSelectionModel.getSelectionRows.

Returns the selection in terms of rows.

public TreeSelectionListener[]

Returns:

all of this model's TreeSelectionListeners or an empty array if no tree selection listeners are currently registered
getTreeSelectionListeners
()

Returns an array of all the tree selection listeners registered on this model.

protected void
insureRowContinuity()

Makes sure the currently selected TreePaths are valid for the current selection mode.

protected void
insureUniqueness()

This method is obsolete and its implementation is now a noop.

public boolean
isPathSelected(TreePath path)

Implements javax.swing.tree.TreeSelectionModel.isPathSelected.

Returns true if the path, path, is in the current selection.

public boolean
isRowSelected(int row)

Implements javax.swing.tree.TreeSelectionModel.isRowSelected.

Returns true if the row identified by row is selected.

public boolean
isSelectionEmpty()

Implements javax.swing.tree.TreeSelectionModel.isSelectionEmpty.

Returns true if the selection is currently empty.

protected void
notifyPathChange(Vector<?>
the vector of the changed paths
changedPaths
,
TreePath
the old selection path
oldLeadSelection
)
Deprecated As of JDK version 1.7

Notifies listeners of a change in path.

private void
public synchronized void
removePropertyChangeListener(PropertyChangeListener
the PropertyChangeListener to be removed
listener
)

Implements javax.swing.tree.TreeSelectionModel.removePropertyChangeListener.

Removes a PropertyChangeListener from the listener list.

public void
removeSelectionPath(TreePath
the path to remove from the selection
path
)

Implements javax.swing.tree.TreeSelectionModel.removeSelectionPath.

Removes path from the selection.

public void
removeSelectionPaths(TreePath[]
the paths to remove from the selection
paths
)

Implements javax.swing.tree.TreeSelectionModel.removeSelectionPaths.

Removes paths from the selection.

public void
removeTreeSelectionListener(TreeSelectionListener
the listener to remove
x
)

Implements javax.swing.tree.TreeSelectionModel.removeTreeSelectionListener.

Removes x from the list of listeners that are notified each time the set of selected TreePaths changes.

public void
resetRowSelection()

Implements javax.swing.tree.TreeSelectionModel.resetRowSelection.

Updates this object's mapping from TreePath to rows.

public void
setRowMapper(RowMapper newMapper)

Implements javax.swing.tree.TreeSelectionModel.setRowMapper.

Sets the RowMapper instance.

public void
setSelectionMode(int mode)

Implements javax.swing.tree.TreeSelectionModel.setSelectionMode.

Sets the selection model, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.

public void
setSelectionPath(TreePath
new path to select
path
)

Implements javax.swing.tree.TreeSelectionModel.setSelectionPath.

Sets the selection to path.

public void
setSelectionPaths(TreePath[]
the new selection
pPaths
)

Implements javax.swing.tree.TreeSelectionModel.setSelectionPaths.

Sets the selection.

public String

Returns:

a String representation of this object
toString
()

Overrides java.lang.Object.toString.

Returns a string that displays and identifies this object's properties.

protected void
updateLeadIndex()

Updates the leadIndex instance variable.

private static int
private void
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

changeSupportback to summary
protected SwingPropertyChangeSupport changeSupport

Used to messaged registered listeners.

lastPathsback to summary
private Hashtable<TreePath, Boolean> lastPaths
leadIndexback to summary
protected int leadIndex

Index of the lead path in selection.

leadPathback to summary
protected TreePath leadPath

Last path that was added.

leadRowback to summary
protected int leadRow

Lead row.

listenerListback to summary
protected EventListenerList listenerList

Event listener list.

listSelectionModelback to summary
protected DefaultListSelectionModel listSelectionModel

Handles maintaining the list selection model. The RowMapper is used to map from a TreePath to a row, and the value is then placed here.

rowMapperback to summary
protected transient RowMapper rowMapper

Provides a row for a given path.

selectionback to summary
protected TreePath[] selection

Paths that are currently selected. Will be null if nothing is currently selected.

SELECTION_MODE_PROPERTYback to summary
public static final String SELECTION_MODE_PROPERTY

Property name for selectionMode.

selectionModeback to summary
protected int selectionMode

Mode for the selection, will be either SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.

tempPathsback to summary
private TreePath[] tempPaths
uniquePathsback to summary
private Hashtable<TreePath, Boolean> uniquePaths

Used to make sure the paths are unique, will contain all the paths in selection.

Constructor Detail

DefaultTreeSelectionModelback to summary
public DefaultTreeSelectionModel()

Creates a new instance of DefaultTreeSelectionModel that is empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION.

Method Detail

addPropertyChangeListenerback to summary
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)

Implements javax.swing.tree.TreeSelectionModel.addPropertyChangeListener.

Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired when the selection mode changes.

Parameters
listener:PropertyChangeListener

the PropertyChangeListener to be added

addSelectionPathback to summary
public void addSelectionPath(TreePath path)

Implements javax.swing.tree.TreeSelectionModel.addSelectionPath.

Adds path to the current selection. If path is not currently in the selection the TreeSelectionListeners are notified. This has no effect if path is null.

Parameters
path:TreePath

the new path to add to the current selection

addSelectionPathsback to summary
public void addSelectionPaths(TreePath[] paths)

Implements javax.swing.tree.TreeSelectionModel.addSelectionPaths.

Adds paths to the current selection. If any of the paths in paths are not currently in the selection the TreeSelectionListeners are notified. This has no effect if paths is null.

The lead path is set to the last element in paths.

If the selection mode is CONTIGUOUS_TREE_SELECTION, and adding the new paths would make the selection discontiguous. Then two things can result: if the TreePaths in paths are contiguous, then the selection becomes these TreePaths, otherwise the TreePaths aren't contiguous and the selection becomes the first TreePath in paths.

Parameters
paths:TreePath[]

the new path to add to the current selection

addTreeSelectionListenerback to summary
public void addTreeSelectionListener(TreeSelectionListener x)

Implements javax.swing.tree.TreeSelectionModel.addTreeSelectionListener.

Adds x to the list of listeners that are notified each time the set of selected TreePaths changes.

Parameters
x:TreeSelectionListener

the new listener to be added

arePathsContiguousback to summary
protected boolean arePathsContiguous(TreePath[] paths)

Returns true if the paths are contiguous, or this object has no RowMapper.

Parameters
paths:TreePath[]

array of paths to check

Returns:boolean

whether the paths are contiguous, or this object has no RowMapper

canPathsBeAddedback to summary
protected boolean canPathsBeAdded(TreePath[] paths)

Used to test if a particular set of TreePaths can be added. This will return true if paths is null (or empty), or this object has no RowMapper, or nothing is currently selected, or the selection mode is DISCONTIGUOUS_TREE_SELECTION, or adding the paths to the current selection still results in a contiguous set of TreePaths.

Parameters
paths:TreePath[]

array of TreePaths to check

Returns:boolean

whether the particular set of TreePaths can be added

canPathsBeRemovedback to summary
protected boolean canPathsBeRemoved(TreePath[] paths)

Returns true if the paths can be removed without breaking the continuity of the model. This is rather expensive.

Parameters
paths:TreePath[]

array of TreePath to check

Returns:boolean

whether the paths can be removed without breaking the continuity of the model

clearSelectionback to summary
public void clearSelection()

Implements javax.swing.tree.TreeSelectionModel.clearSelection.

Empties the current selection. If this represents a change in the current selection, the selection listeners are notified.

cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Returns a clone of this object with the same selection. This method does not duplicate selection listeners and property listeners.

Exceptions
CloneNotSupportedException:
never thrown by instances of this class
fireValueChangedback to summary
protected void fireValueChanged(TreeSelectionEvent e)

Notifies all listeners that are registered for tree selection events on this object.

Parameters
e:TreeSelectionEvent

the event that characterizes the change

See Also
addTreeSelectionListener, EventListenerList
getLeadSelectionPathback to summary
public TreePath getLeadSelectionPath()

Implements javax.swing.tree.TreeSelectionModel.getLeadSelectionPath.

Returns the last path that was added. This may differ from the leadSelectionPath property maintained by the JTree.

getLeadSelectionRowback to summary
public int getLeadSelectionRow()

Implements javax.swing.tree.TreeSelectionModel.getLeadSelectionRow.

Returns the lead selection index. That is the last index that was added.

getListenersback to summary
public <T extends EventListener> T[] getListeners(Class<T> listenerType)

Returns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a DefaultTreeSelectionModel m for its tree selection listeners with the following code:

TreeSelectionListener[] tsls = (TreeSelectionListener[])(m.getListeners(TreeSelectionListener.class));
If no such listeners exist, this method returns an empty array.
Parameters
<T>
the listener type
listenerType:Class<T>

the type of listeners requested

Returns:T[]

an array of all objects registered as FooListeners on this component, or an empty array if no such listeners have been added

Exceptions
ClassCastException:
if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since
1.3
See Also
getTreeSelectionListeners, getPropertyChangeListeners
getMaxSelectionRowback to summary
public int getMaxSelectionRow()

Implements javax.swing.tree.TreeSelectionModel.getMaxSelectionRow.

Returns the largest value obtained from the RowMapper for the current set of selected TreePaths. If nothing is selected, or there is no RowMapper, this will return -1.

getMinSelectionRowback to summary
public int getMinSelectionRow()

Implements javax.swing.tree.TreeSelectionModel.getMinSelectionRow.

Returns the smallest value obtained from the RowMapper for the current set of selected TreePaths. If nothing is selected, or there is no RowMapper, this will return -1.

getPropertyChangeListenersback to summary
public PropertyChangeListener[] getPropertyChangeListeners()

Returns an array of all the property change listeners registered on this DefaultTreeSelectionModel.

Returns:PropertyChangeListener[]

all of this model's PropertyChangeListeners or an empty array if no property change listeners are currently registered

Since
1.4
See Also
addPropertyChangeListener, removePropertyChangeListener
getRowMapperback to summary
public RowMapper getRowMapper()

Implements javax.swing.tree.TreeSelectionModel.getRowMapper.

Returns the RowMapper instance that is able to map a TreePath to a row.

getSelectionCountback to summary
public int getSelectionCount()

Implements javax.swing.tree.TreeSelectionModel.getSelectionCount.

Returns the number of paths that are selected.

getSelectionModeback to summary
public int getSelectionMode()

Implements javax.swing.tree.TreeSelectionModel.getSelectionMode.

Returns the selection mode, one of SINGLE_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION or CONTIGUOUS_TREE_SELECTION.

getSelectionPathback to summary
public TreePath getSelectionPath()

Implements javax.swing.tree.TreeSelectionModel.getSelectionPath.

Returns the first path in the selection. This is useful if there if only one item currently selected.

getSelectionPathsback to summary
public TreePath[] getSelectionPaths()

Implements javax.swing.tree.TreeSelectionModel.getSelectionPaths.

Returns the selection.

Returns:TreePath[]

the selection

getSelectionRowsback to summary
public int[] getSelectionRows()

Implements javax.swing.tree.TreeSelectionModel.getSelectionRows.

Returns the selection in terms of rows. There is not necessarily a one-to-one mapping between the TreePaths returned from getSelectionPaths and this method. In particular, if a TreePath is not viewable (the RowMapper returns -1 for the row corresponding to the TreePath), then the corresponding row is not included in the returned array. For example, if the selection consists of two paths, A and B, with A at row 10, and B not currently viewable, then this method returns an array with the single entry 10.

Returns:int[]

the selection in terms of rows

getTreeSelectionListenersback to summary
public TreeSelectionListener[] getTreeSelectionListeners()

Returns an array of all the tree selection listeners registered on this model.

Returns:TreeSelectionListener[]

all of this model's TreeSelectionListeners or an empty array if no tree selection listeners are currently registered

Since
1.4
See Also
addTreeSelectionListener, removeTreeSelectionListener
insureRowContinuityback to summary
protected void insureRowContinuity()

Makes sure the currently selected TreePaths are valid for the current selection mode. If the selection mode is CONTIGUOUS_TREE_SELECTION and a RowMapper exists, this will make sure all the rows are contiguous, that is, when sorted all the rows are in order with no gaps. If the selection isn't contiguous, the selection is reset to contain the first set, when sorted, of contiguous rows.

If the selection mode is SINGLE_TREE_SELECTION and more than one TreePath is selected, the selection is reset to contain the first path currently selected.

insureUniquenessback to summary
protected void insureUniqueness()

This method is obsolete and its implementation is now a noop. It's still called by setSelectionPaths and addSelectionPaths, but only for backwards compatibility.

isPathSelectedback to summary
public boolean isPathSelected(TreePath path)

Implements javax.swing.tree.TreeSelectionModel.isPathSelected.

Returns true if the path, path, is in the current selection.

isRowSelectedback to summary
public boolean isRowSelected(int row)

Implements javax.swing.tree.TreeSelectionModel.isRowSelected.

Returns true if the row identified by row is selected.

isSelectionEmptyback to summary
public boolean isSelectionEmpty()

Implements javax.swing.tree.TreeSelectionModel.isSelectionEmpty.

Returns true if the selection is currently empty.

notifyPathChangeback to summary
protected void notifyPathChange(Vector<?> changedPaths, TreePath oldLeadSelection)

Deprecated

As of JDK version 1.7

Notifies listeners of a change in path. changePaths should contain instances of PathPlaceHolder.

Parameters
changedPaths:Vector<?>

the vector of the changed paths

oldLeadSelection:TreePath

the old selection path

Annotations
@Deprecated
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
Annotations
@Serial
removePropertyChangeListenerback to summary
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)

Implements javax.swing.tree.TreeSelectionModel.removePropertyChangeListener.

Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters
listener:PropertyChangeListener

the PropertyChangeListener to be removed

removeSelectionPathback to summary
public void removeSelectionPath(TreePath path)

Implements javax.swing.tree.TreeSelectionModel.removeSelectionPath.

Removes path from the selection. If path is in the selection The TreeSelectionListeners are notified. This has no effect if path is null.

Parameters
path:TreePath

the path to remove from the selection

removeSelectionPathsback to summary
public void removeSelectionPaths(TreePath[] paths)

Implements javax.swing.tree.TreeSelectionModel.removeSelectionPaths.

Removes paths from the selection. If any of the paths in paths are in the selection the TreeSelectionListeners are notified. This has no effect if paths is null.

Parameters
paths:TreePath[]

the paths to remove from the selection

removeTreeSelectionListenerback to summary
public void removeTreeSelectionListener(TreeSelectionListener x)

Implements javax.swing.tree.TreeSelectionModel.removeTreeSelectionListener.

Removes x from the list of listeners that are notified each time the set of selected TreePaths changes.

Parameters
x:TreeSelectionListener

the listener to remove

resetRowSelectionback to summary
public void resetRowSelection()

Implements javax.swing.tree.TreeSelectionModel.resetRowSelection.

Updates this object's mapping from TreePath to rows. This should be invoked when the mapping from TreePaths to integers has changed (for example, a node has been expanded).

You do not normally have to call this, JTree and its associated Listeners will invoke this for you. If you are implementing your own View class, then you will have to invoke this.

This will invoke insureRowContinuity to make sure the currently selected TreePaths are still valid based on the selection mode.

setRowMapperback to summary
public void setRowMapper(RowMapper newMapper)

Implements javax.swing.tree.TreeSelectionModel.setRowMapper.

Sets the RowMapper instance. This instance is used to determine the row for a particular TreePath.

setSelectionModeback to summary
public void setSelectionMode(int mode)

Implements javax.swing.tree.TreeSelectionModel.setSelectionMode.

Sets the selection model, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. If mode is not one of the defined value, DISCONTIGUOUS_TREE_SELECTION is assumed.

This may change the selection if the current selection is not valid for the new mode. For example, if three TreePaths are selected when the mode is changed to SINGLE_TREE_SELECTION, only one TreePath will remain selected. It is up to the particular implementation to decide what TreePath remains selected.

Setting the mode to something other than the defined types will result in the mode becoming DISCONTIGUOUS_TREE_SELECTION.

setSelectionPathback to summary
public void setSelectionPath(TreePath path)

Implements javax.swing.tree.TreeSelectionModel.setSelectionPath.

Sets the selection to path. If this represents a change, then the TreeSelectionListeners are notified. If path is null, this has the same effect as invoking clearSelection.

Parameters
path:TreePath

new path to select

setSelectionPathsback to summary
public void setSelectionPaths(TreePath[] pPaths)

Implements javax.swing.tree.TreeSelectionModel.setSelectionPaths.

Sets the selection. Whether the supplied paths are taken as the new selection depends upon the selection mode. If the supplied array is null, or empty, the selection is cleared. If the selection mode is SINGLE_TREE_SELECTION, only the first path in pPaths is used. If the selection mode is CONTIGUOUS_TREE_SELECTION and the supplied paths are not contiguous, then only the first path in pPaths is used. If the selection mode is DISCONTIGUOUS_TREE_SELECTION, then all paths are used.

All null paths in pPaths are ignored.

If this represents a change, all registered TreeSelectionListeners are notified.

The lead path is set to the last unique path.

The paths returned from getSelectionPaths are in the same order as those supplied to this method.

Parameters
pPaths:TreePath[]

the new selection

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string that displays and identifies this object's properties.

Returns:String

a String representation of this object

updateLeadIndexback to summary
protected void updateLeadIndex()

Updates the leadIndex instance variable.

validateSelectionModeback to summary
private static int validateSelectionMode(int mode)
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException
Annotations
@Serial