Generated by
JDiff

javax.swing.tree Documentation Differences

This file contains all the changes in documentation in the package javax.swing.tree as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class AbstractLayoutCache

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.10 0213 12/0203/0001 @author Scott Violet

Class AbstractLayoutCache.NodeDimensions

Used by AbstractLayoutCache to determingdetermine the size and x origin of a particular node.
Class AbstractLayoutCache.NodeDimensions, Rectangle getNodeDimensions(Object, int, int, boolean, Rectangle)

Returns by reference in bounds the size and x origin to place value at. The receivercalling method is responsible for determingdetermining the Y location. If bounds is null a newly created Rectangle should be returned otherwise the value should be placed in bounds and returned. @param value the value to be represented @param row row being queried @param depth the depth of the row @param expanded true if row is expanded false otherwise @param bounds a Rectangle containing the size needed to represent value @return a Rectangle containing the node dimensions or null if node has no dimension

Class AbstractLayoutCache, Rectangle getBounds(TreePath, Rectangle)

Returns a rectangle giving the bounds needed to draw path. @param path a TreePath specifying a node @param placeIn a Rectangle object giving the available space @return a Rectangle object specifying the space to be used
Class AbstractLayoutCache, boolean getExpandedState(TreePath)

Returns true if the path is expanded and visible. @param path the path being queried @return true if the path is expanded and visible false otherwise
Class AbstractLayoutCache, TreeModel getModel()

Returns the TreeModel that is providing the data. @return the TreeModel that is providing the data
Class AbstractLayoutCache, NodeDimensions getNodeDimensions()

Returns the object that renders nodes in the tree and which is responsible for calculating the dimensions of individual nodes. @return the NodeDimensions object
Class AbstractLayoutCache, Rectangle getNodeDimensions(Object, int, int, boolean, Rectangle)

Returns by reference in sizeplaceIn the size needed to reprensentrepresent value. If sizeinPlace is null a newly created DimensionRectangle should be returned otherwise the value should be placed in sizeinPlace and returned. This will return null if there is no renderer. @param value the value to be represented @param row row being queried @param depth the depth of the row @param expanded true if row is expanded false otherwise @param placeIn a Rectangle containing the size needed to represent value @return a Rectangle containing the node dimensions or null if node has no dimension
Class AbstractLayoutCache, TreePath getPathClosestTo(int, int)

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. @param x the horizontal component of the desired location @param y the vertical component of the desired location @return the TreePath closest to the specified point
Class AbstractLayoutCache, TreePath getPathForRow(int)

Returns the path for passed in row. If row is not visible null is returned. @param row the row being queried @return the TreePath for the given row
Class AbstractLayoutCache, int getPreferredHeight()

Returns the preferred height. @return the preferred height
Class AbstractLayoutCache, int getPreferredWidth(Rectangle)

Returns the preferred width for the passed in region. The region is defined by the path closest to (bounds.x bounds.y) and ends at bounds.height + bounds.y. If bounds is null the preferred width for all the nodes will be returned (and this may be a VERY expensive computation). @param bounds the region being queried @return the preferred width for the passed in region
Class AbstractLayoutCache, int getRowCount()

Number of rows being displayed. @return the number of rows being displayed
Class AbstractLayoutCache, int getRowForPath(TreePath)

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. @param path the TreePath being queried @return the row where the last item in path is visible or -1 if any elements in path aren't currently visible
Class AbstractLayoutCache, int[] getRowsForPaths(TreePath[])

Returns the rows that the TreePath instances in path are being displayed at. The receiverThis method should return an array of the same length as that passed in and if one of the TreePaths in path is not valid its entry in the array should be set to -1. @param paths the array of TreePaths being queried @return an array of the same length that is passed in containing the rows that each corresponding where each TreePath is displayed; if paths is null null is returned
Class AbstractLayoutCache, TreeSelectionModel getSelectionModel()

Returns the model used to maintain the selection. @return the treeSelectionModel
Class AbstractLayoutCache, int getVisibleChildCount(TreePath)

Returns the number of visible children for row. @param path the path being queried @return the number of visible children for the specified path
Class AbstractLayoutCache, Enumeration getVisiblePathsFrom(TreePath)

Returns an Enumerator that increments over the visible paths starting at the passed in location. The ordering of the enumeration is based on how the paths are displayed. The first element of the returned enumeration will be path unless it isn't visible in which case null will be returned. @param path the starting location for the enumeration @return the Enumerator starting at the desired location
Class AbstractLayoutCache, void invalidatePathBounds(TreePath)

Instructs the LayoutCache that the bounds for path are invalid and need to be updated. @param path the path being updated
Class AbstractLayoutCache, void invalidateSizes()

Informs the TreeState that it needs to recalculate all the sizes it is referencing.
Class AbstractLayoutCache, void setExpandedState(TreePath, boolean)

Marks the path path expanded state to isExpanded. @param path the path being expanded or collapsed @param isExpanded true if the path should be expanded false otherwise
Class AbstractLayoutCache, void setModel(TreeModel)

Sets the TreeModel that will provide the data. @param newModel the TreeModel that is to provide the data
Class AbstractLayoutCache, void setNodeDimensions(NodeDimensions)

Sets the renderer that is responsible for drawing nodes in the tree and which is threfore responsible focfor calculating the dimensions of individual nodes. @param nd a NodeDimensions object
Class AbstractLayoutCache, void setRootVisible(boolean)

Determines whether or not the root node from the TreeModel is visible. @param rootVisible true if the root node of the tree is to be displayed @see #rootVisible @beaninfo bound: true description: Whether or not the root node from the TreeModel is visible.
Class AbstractLayoutCache, void setSelectionModel(TreeSelectionModel)

Sets the TreeSelectionModel used to manage the selection to new LSM. @param newLSM the new TreeSelectionModel
Class AbstractLayoutCache, void treeNodesChanged(TreeModelEvent)

Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays but other attributes have changed and may affect presentation. Example: the name of a file has changed but it is in the same location in the file system.

e.path() returns the path the parent of the changed node(s).

e.childIndices() returns the index(es) of the changed node(s).

@param e the TreeModelEvent
Class AbstractLayoutCache, void treeNodesInserted(TreeModelEvent)

Invoked after nodes have been inserted into the tree.

e.path() returns the parent of the new nodes

e.childIndices() returns the indices of the new nodes in ascending order.

@param e the TreeModelEvent
Class AbstractLayoutCache, void treeNodesRemoved(TreeModelEvent)

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree this method may only be invoked once for the root of the removed subtree not once for each individual set of siblings removed.

e.path() returns the former parent of the deleted nodes.

e.childIndices() returns the indices the nodes had before they were deleted in ascending order.

@param e the TreeModelEvent
Class AbstractLayoutCache, void treeStructureChanged(TreeModelEvent)

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

e.path() holds the path to the node.

e.childIndices() returns null.

@param e the TreeModelEvent

Class DefaultMutableTreeNode

A DefaultMutableTreeNode is a general-purpose node in a tree data structure. For examples of using default mutable tree nodes see How to Use Trees in The Java Tutorial.

A tree node may have at most one parent and 0 or more children. DefaultMutableTreeNode provides operations for examining and modifying a node's parent and children and also operations for examining the tree that the node is a part of. A node's tree is the set of all nodes that can be reached by starting at the node and following all the possible links to parents and children. A node with no parent is the root of its tree; a node with no children is a leaf. A tree may consist of many subtrees each node acting as the root for its own subtree.

This class provides enumerations for efficiently traversing a tree or subtree in various orders or for following the path between two nodes. A DefaultMutableTreeNode may also hold a reference to a user object the use of which is left to the user. Asking a DefaultMutableTreeNode for its string representation with toString() returns the string representation of its user object.

This is not a thread safe class.If you intend to use a DefaultMutableTreeNode (or a tree of TreeNodes) in more than one thread you need to do your own synchronizing. A good convention to adopt is synchronizing on the root node of a tree.

While DefaultMutableTreeNode implements the MutableTreeNode interface and will allow you to add in any implementation of MutableTreeNode not all of the methods in DefaultMutableTreeNode will be applicable to all MutableTreeNodes implementations. Especially with some of the enumerations that are provided using some of these methods assumes the DefaultMutableTreeNode contains only DefaultMutableNode instances. All of the TreeNode/MutableTreeNode methods will behave as defined no matter what implementations are added.

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. A futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see MutableTreeNode @version 1.15 0218 12/0203/0001 @author Rob Davis

Class DefaultMutableTreeNode, DefaultMutableTreeNode getPreviousNode()

Returns the node that precedes this node in a preorder traversal of this node's tree. Returns null if this node is the first node of the traveraltraversal -- the root of the tree. This is an inefficient way to traverse the entire tree; use an enumeration instead. @see #preorderEnumeration @return the node that precedes this node in a preorder traversal or null if this node is the first

Class DefaultTreeCellEditor

A TreeCellEditor. You need to supply an instance of DefaultTreeCellRenderer so that the icons can be obtained. You can optionalyoptionally supply a TreeCellEditor that will be layed out according to the icon in the DefaultTreeCellRenderer. If you do not supply a TreeCellEditor a TextField will be used. Editing is started on a triple mouse click or after a click pause click and a delay of 1200 miliseconds.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see javax.swing.JTree @version 1.17 0225 12/0203/0001 @author Scott Violet


Class DefaultTreeCellEditor.DefaultTextField

TextField used when no editor is supplied. This textfield locks into the border it is constructed with. It also prefers its parents font over its font. And if the renderer is not null and no font has been specified the preferred height is that of the renderer.
Class DefaultTreeCellEditor.DefaultTextField, constructor DefaultTreeCellEditor.DefaultTextField(Border)

Constructs a DefaultTreeCellEditor$.DefaultTextField object. @param border a Border object
Class DefaultTreeCellEditor.DefaultTextField, Dimension getPreferredSize()

Overrides JTextField.getPreferredSize to return the preferred size based on current font if set or else use renderer's font. @return a Dimension object containing the preferred size
Class DefaultTreeCellEditor.DefaultTextField, void setBorder(Border)

Sets the border of this component. The Border object is responsible for defining the insets for the component (overriding any insets set directly on the component) and for optionally rendering any border decorations within the bounds of those insets. Borders should be used (rather than insets) for creating both decorative and non-decorative (such as margins and padding) regions for a swing component. Compound borders can be used to nest multiple borders within a single component.

This is a bound property. @param border the border to be rendered for this component @see Border @see CompoundBorder @beaninfo bound: true preferred: true attribute: visualUpdate true description: The component's border.


Class DefaultTreeCellEditor.EditorContainer

Container responsible for placing the editingComponent.
Class DefaultTreeCellEditor.EditorContainer, constructor DefaultTreeCellEditor.EditorContainer()

Constructs an EditorContainer object.
Class DefaultTreeCellEditor.EditorContainer, void doLayout()

Lays out this Container. If editing the editor will be placed at offset in the x direction and 0 for y.
Class DefaultTreeCellEditor.EditorContainer, Dimension getPreferredSize()

Returns the preferred size for the Container. This will be theat least preferred size of the editor offset byplus offset. @return a Dimension containing the preferred size for the Container; if editingComponent is null the Dimension returned is 0 0

Class DefaultTreeCellEditor, constructor DefaultTreeCellEditor(JTree, DefaultTreeCellRenderer)

Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and a default editor. (Use this constructor for normal editing.) @param tree a JTree object @param renderer a DefaultTreeCellRenderer object
Class DefaultTreeCellEditor, constructor DefaultTreeCellEditor(JTree, DefaultTreeCellRenderer, TreeCellEditor)

Constructs a DefaultTreeCellEditor object for a JTree using the specified renderer and the specified editor. (Use this constructor for specialized editing.) @param tree a JTree object @param renderer a DefaultTreeCellRenderer object @param editor a TreeCellEditor object
Class DefaultTreeCellEditor, void addCellEditorListener(CellEditorListener)

Adds the CellEditorListener. @param l the listener to be added
Class DefaultTreeCellEditor, boolean canEditImmediately(EventObject)

Returns true if event is null or it is a MouseEvent with a click count > 2 and inHitRegion returns true. @param event the event being studied
Class DefaultTreeCellEditor, void cancelCellEditing()

Messages cancelCellEditing to the realEditor and removes it from this instance.
Class DefaultTreeCellEditor, Container createContainer()

Creates the container to manage placement of editingComponent.
Class DefaultTreeCellEditor, TreeCellEditor createTreeCellEditor()

This is invoked if a TreeCellEditor is not supplied in the constructor. It returns a TextField editor. @return a new TextField editor
Class DefaultTreeCellEditor, Color getBorderSelectionColor()

Returns the color the border is drawn. @returns the border selection color
Class DefaultTreeCellEditor, Object getCellEditorValue()

Returns the value currently being edited. @return the value currently being edited
Class DefaultTreeCellEditor, Font getFont()

Gets the font used for editing. @return the editing Font @see #setFont
Class DefaultTreeCellEditor, Component getTreeCellEditorComponent(JTree, Object, boolean, boolean, boolean, int)

Configures the editor. Passed onto the realEditor.
Class DefaultTreeCellEditor, boolean inHitRegion(int, int)

ShouldReturns return true if the passed in location is a valid mouse location to start editing from. This is implemented to return false if x is < the width of the icon and icon gap displayed by the renderer. In other words this returns true if the user clicks over the text part displayed by the renderer and false otherwise. @param x the x-coordinate of the point @param y the y-coordinate of the point @return true if the passed in location is a valid mouse location
Class DefaultTreeCellEditor, boolean isCellEditable(EventObject)

If the realEditor returns true to this message prepareForEditing is messaged and true is returned.
Class DefaultTreeCellEditor, void removeCellEditorListener(CellEditorListener)

Removes the previously added CellEditorListener l. @param the listener to be removed
Class DefaultTreeCellEditor, void setBorderSelectionColor(Color)

Sets the color to use for the border. @param newColor the new border color
Class DefaultTreeCellEditor, void setFont(Font)

Sets the font to edit with. null indicates the renderers font should be used. This will NOT override any font you have set in the editor the receiver was instantied with. If null for an editor was passed in a default editor will be created that will pick up this font. @param font the editing Font @see #getFont
Class DefaultTreeCellEditor, void setTree(JTree)

Sets the tree currently editing for. This is needed to add a selection listener. @param newTree the new tree to be edited
Class DefaultTreeCellEditor, boolean shouldSelectCell(EventObject)

Messages the realEditor for the return value.
Class DefaultTreeCellEditor, boolean shouldStartEditingTimer(EventObject)

Returns true if event is a MouseEvent and the click count is 1. @param event the event being studied
Class DefaultTreeCellEditor, boolean stopCellEditing()

If the realEditor will allow editing to stop the realEditor is removed and true is returned otherwise false is returned.
Class DefaultTreeCellEditor, void valueChanged(TreeSelectionEvent)

Resets lastPath.
Class DefaultTreeCellEditor, boolean canEdit

Should isCellEditable return true ThisAs of Java 2 platform isv1.4 set inthis field configure..should no longer be used. based on the path being edited and the selected selectedIf you wish to provide similar behavior you should directly pathoverride isCellEditable.
Class DefaultTreeCellEditor, Component editingComponent

Component used in editing obtained from the editingContainer.
Class DefaultTreeCellEditor, Container editingContainer

Editing container will contain the editorComponent.
Class DefaultTreeCellEditor, Font font

Font to paint with null indicates font of renderer is to be used.
Class DefaultTreeCellEditor, TreePath lastPath

lastLast path that was selected.
Class DefaultTreeCellEditor, int lastRow

Row that was last passed into getTreeCellEditorComponent.
Class DefaultTreeCellEditor, int offset

Used in editing. Indicates x position to place editingComponent.
Class DefaultTreeCellEditor, JTree tree

JTree instance listening too.

Class DefaultTreeCellRenderer

Displays an entry in a tree. See How to Use Trees in The Java Tutorial for examples of customizing node display using this class.

Implementation Note: This class overrides validate revalidate repaint and firePropertyChange solely to improve performance. If not overridden these frequently called methods would execute code paths that are unnecessary for the default tree cell renderer. If you write your own renderer take care to weigh the benefits and drawbacks of overriding these methods.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.40 0246 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet

Class DefaultTreeCellRenderer, Font getFont()

Gets the font of this component. @return Thisthis component's font.; Ifif a font has not been set for this component the font of its parent is returned. @see #setFont @since JDK1.0
Class DefaultTreeCellRenderer, Color borderSelectionColor

Color to use for the backgroundfocus indicator when the node isn'thas selectedfocus.

Class DefaultTreeModel

A simple tree data model that uses TreeNodes. For further information and examples that use DefaultTreeModel see How to Use Trees in The Java Tutorial.

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. A future releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.41 0251 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet

Class DefaultTreeModel, int getIndexOfChild(Object, Object)

Returns the index of child in parent. If either the parent or child is null returns -1. @param parent a note in the tree obtained from this data source @param child the node we are interested in @return the index of the child in the parent or -1 if either the parent or the child is null
Class DefaultTreeModel, EventListener[] getListeners(Class)

ReturnReturns 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 DefaultTreeModel m for its tree model listeners ofwith the givenfollowing typecode: that

TreeModelListener[] tmls = (TreeModelListener[])(m.getListeners(TreeModelListener.class));
wereIf addedno such listeners toexist this modelmethod returns an empty array. @returnsparam alllistenerType the type of thelisteners requested; this parameter should specify an interface that descends from java.util.EventListener @return an array of all objects recievingregistered as listenerTypeFoo notificationsListeners fromon this modelcomponent or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getTreeModelListeners @since 1.3
Class DefaultTreeModel, void setRoot(TreeNode)

Sets the root to root. This willA null throwroot an IllegalArgumentException ifimplies the tree rootis to display nothing and is nulllegal.

Class DefaultTreeSelectionModel

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see javax.swing.JTree @version 1.37 0243 12/0203/0001 @author Scott Violet

Class DefaultTreeSelectionModel, EventListener[] getListeners(Class)

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 ofwith the givenfollowing typecode: that

TreeSelectionListener[] tsls = (TreeSelectionListener[])(m.getListeners(TreeSelectionListener.class));
wereIf addedno such listeners toexist this modelmethod returns an empty array. @param listenerType the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects receivingregistered as listenerTypeFooListeners notificationson from this modelcomponent or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getTreeSelectionListeners @see #getPropertyChangeListeners @since 1.3
Class DefaultTreeSelectionModel, boolean isRowSelected(int)

Returns true if the row identitifedidentified by row is selected.

Class ExpandVetoException

Exception used to stop and expand/collapse from happening. See How to Write a Tree-Will-Expand Listener in The Java Tutorial for further information and examples. @version 1.7 028 12/0203/0001 @author Scott Violet

Class FixedHeightLayoutCache

NOTE: This will become more open in a future release.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.13 0219 12/0203/0001 @author Scott Violet


Class MutableTreeNode

Defines the requirements for a tree node object that can change -- by adding or removing child nodes or by changing the contents of a user object stored in the node. @see DefaultMutableTreeNode @see javax.swing.JTree @version 1.8 029 12/0203/0001 @author Rob Davis @author Scott Violet

Class RowMapper

Defines the requirements for an object that translates paths in the tree into display rows. @version 1.10 0211 12/0203/0001 @author Scott Violet

Class TreeCellEditor

Adds to CellEditor the extensions necessary to configure an editor in a tree. @see javax.swing.JTree @version 1.10 0212 12/0203/0001 @author Scott Violet
Class TreeCellEditor, Component getTreeCellEditorComponent(JTree, Object, boolean, boolean, boolean, int)

Sets an initial value for the editor. This will cause the editor to stopEditing and lose any partially edited value if the editor is editing when this method is called.

Returns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input. @param tabletree the JTree that is asking the editor to edit; Thisthis parameter can be null. @param value the value of the cell to be edited. @param isSelected true is the cell is to be renderer with selection highlighting @param expanded true if the node is expanded @param leaf true if the node is a leaf node @param row the row index of the node being edited @return the component for editing


Class TreeCellRenderer

Defines the requirements for an object that displays a tree node. See How to Use Trees in The Java Tutorial for an example of implementing a tree cell renderer that displays custom icons. @version 1.16 0218 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet
Class TreeCellRenderer, Component getTreeCellRendererComponent(JTree, Object, boolean, boolean, boolean, int, boolean)

Sets the value of the current tree cell to value. If selected is true the cell will be drawn as if selected. If expanded is true the node is currently expanded and if leaf is true the node represets a leaf anfand if hasFocus is true the node currently has focus. tree is the JTree the receiver is being configured for. Returns the Component that the renderer uses to draw the value. @return the Component that the renderer uses to draw the value.

Class TreeModel

The interface that defines a suitable data model for a JTree. For further information on tree models including an example of a custom implementation see How to Use Trees in The Java Tutorial. @version 1.16 0219 12/0203/0001 @author Rob Davis @author Ray Ryan
Class TreeModel, void addTreeModelListener(TreeModelListener)

Adds a listener for the TreeModelEvent posted after the tree changes. @see #removeTreeModelListener @param l the listener to add @see #removeTreeModelListener
Class TreeModel, Object getChild(Object, int)

Returns the child of parent at index index in the parent's child array. parent must be a node previously obtained from this data source. This should not return null if index is a valid index for parent (that is index >= 0 && index )). @param parent a node in the tree obtained from this data source @return the child of parent at index index
Class TreeModel, int getChildCount(Object)

Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source. @param parent a node in the tree obtained from this data source @return the number of children of the node parent
Class TreeModel, int getIndexOfChild(Object, Object)

Returns the index of child in parent. If parent is null or child is null returns -1. @param parent a note in the tree obtained from this data source @param child the node we are interested in @return the index of the child in the parent or -1 if either child or parent are null
Class TreeModel, Object getRoot()

Returns the root of the tree. Returns null only if the tree has no nodes. @return the root of the tree
Class TreeModel, boolean isLeaf(Object)

Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem for example may contain no files; the node representing the directory is not a leaf but it also has no children. @param node a node in the tree obtained from this data source @return true if node is a leaf
Class TreeModel, void removeTreeModelListener(TreeModelListener)

Removes a listener previously added with addTreeModelListener(). @see #addTreeModelListener @param l the listener to remove
Class TreeModel, void valueForPathChanged(TreePath, Object)

Messaged when the user has altered the value for the item identified by path to newValue. If newValue signifies a truly new value the model should post a treeNodesChanged event. @param path path to the node that the user has altered. @param newValue the new value from the TreeCellEditor.

Class TreeNode

Defines the requirements for an object that can be used as a tree node in a JTree.

For further information and examples of using tree nodes see How to Use Tree Nodes in The Java Tutorial. @version 1.17 0219 12/0203/0001 @author Rob Davis @author Scott Violet

Class TreeNode, Enumeration children()

Returns the children of the recieverreceiver as an Enumeration.

Class TreePath

Represents a path to a node. A TreePath is an array of Objects that are vended from a TreeModel. The elements of the array are ordered such that the root is always the first element (index 0) of the array. TreePath is Serializable but if any components of the path are not serializable it will not be written out.

For further information and examples of using tree paths see How to Use Trees in The Java Tutorial.

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. A future releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.25 0227 12/0203/0001 @author Scott Violet @author Philip Milne


Class TreeSelectionModel

This interface represents the current state of the selection for the tree component. For information and examples of using tree selection models see How to Use Trees in The Java Tutorial.

The state of the tree selection is characterized by a set of TreePaths and optionally a set of integers. The mapping from TreePath to integer is done by way of an instance of RowMapper. It is not necessary for a TreeSelectionModel to have a RowMapper to correctly operate but without a RowMapper getSelectionRows will return null.

A TreeSelectionModel can be configured to allow only one path (SINGLE_TREE_SELECTION) a number of continguous paths (CONTIGUOUS_TREE_SELECTION) or a number of discontiguous paths (DISCONTIGUOUS_TREE_SELECTION). A RowMapper is used to determine if TreePaths are contiguous. In the absence of a RowMapper CONTIGUOUS_TREE_SELECTION and DISCONTIGUOUS_TREE_SELECTION behave the same that is they allow any number of paths to be contained in the TreeSelectionModel.

For a selection model of CONTIGUOUS_TREE_SELECTION any time the paths are changed (setSelectionPath addSelectionPath ...) the TreePaths are again checked to make they are contiguous. A check of the TreePaths can also be forced by invoking resetRowSelection. How a set of discontiguous TreePaths is mapped to a contiguous set is left to implementors of this interface to enforce a particular policy.

Implementations should combine duplicate TreePaths that are added to the selection. For example the following code

 TreePath[] paths = new TreePath[] { treePath treePath }; treeSelectionModel.setSelectionPaths(paths); 
should result in only one path being selected: treePath and not two copies of treePath.

The lead TreePath is the last path that was added (or set). The lead row is then the row that corresponds to the TreePath as determined from the RowMapper. @version 1.19 0221 12/0203/0001 @author Scott Violet

Class TreeSelectionModel, boolean isRowSelected(int)

Returns true if the row identitifedidentified by row is selected.

Class VariableHeightLayoutCache

NOTE: This will become more open in a future release.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.13 0218 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet

Class VariableHeightLayoutCache, Rectangle getBounds(TreePath, Rectangle)

Returns the Rectangle enclosing the label portion thatinto which the item identified by rowpath will be drawn into. @param path the path to be drawn @param placeIn the bounds of the enclosing rectangle @return the bounds of the enclosing rectangle or null if the node could not be ascertained
Class VariableHeightLayoutCache, boolean getExpandedState(TreePath)

Returns true if the path is expanded and visible. @return true if the path is expanded and visible otherwise false
Class VariableHeightLayoutCache, TreePath getPathClosestTo(int, int)

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 will 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. @param x the x-coordinate @param y the y-coordinate @return the path to the node that is closest to x y
Class VariableHeightLayoutCache, TreePath getPathForRow(int)

Returns the path for passed in row. If row is not visible null is returned. @param row the location of interest @return the path for row or null if row is not visible
Class VariableHeightLayoutCache, int getPreferredHeight()

Returns the preferred height. @return the preferred height
Class VariableHeightLayoutCache, int getPreferredWidth(Rectangle)

Returns the preferred width and height for the region in visibleRegion. @param bounds the region being queried
Class VariableHeightLayoutCache, int getRowCount()

Returns the number of visible rows. @return the number of visible rows
Class VariableHeightLayoutCache, int getRowForPath(TreePath)

Returns the row thatwhere the last item identified in path is visible at. Will return -1 if any of the elements in path are not currently visible. @param path the TreePath of interest @return the row where the last item in path is visible
Class VariableHeightLayoutCache, int getVisibleChildCount(TreePath)

Returns the number of visible children for rowpath. @return the number of visible children for path
Class VariableHeightLayoutCache, Enumeration getVisiblePathsFrom(TreePath)

Returns an Enumerator that increments over the visible paths starting at the passed in location. The ordering of the enumeration is based on how the paths are displayed. @param path the location in the TreePath to start @return an Enumerator that increments over the visible paths
Class VariableHeightLayoutCache, void invalidatePathBounds(TreePath)

Instructs the LayoutCache that the bounds for path are invalid and need to be updated. @param path the TreePath which is now invalid
Class VariableHeightLayoutCache, void invalidateSizes()

Informs the TreeState that it needs to recalculate all the sizes it is referencing.
Class VariableHeightLayoutCache, boolean isExpanded(TreePath)

Returns true if the value identified by rowpath is currently expanded. @return true if the value identified by path is currently expanded
Class VariableHeightLayoutCache, void setExpandedState(TreePath, boolean)

Marks the path path expanded state to isExpanded. @param path the TreePath of interest @param isExpanded true if the path should be expanded otherwise false
Class VariableHeightLayoutCache, void setModel(TreeModel)

Sets the TreeModel that will provide the data. @param newModel the TreeModel that is to provide the data @beaninfo bound: true description: The TreeModel that will provide the data.
Class VariableHeightLayoutCache, void setNodeDimensions(NodeDimensions)

Sets the renderer that is responsible for drawing nodes in the tree. @param nd the renderer
Class VariableHeightLayoutCache, void setRootVisible(boolean)

Determines whether or not the root node from the TreeModel is visible. @param rootVisible true if the root node of the tree is to be displayed @see #rootVisible @beaninfo bound: true description: Whether or not the root node from the TreeModel is visible.
Class VariableHeightLayoutCache, void treeNodesChanged(TreeModelEvent)

Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays but other attributes have changed and may affect presentation. Example: the name of a file has changed but it is in the same location in the file system.

e.path() returns the path the parent of the changed node(s).

e.childIndices() returns the index(es) of the changed node(s). @param e the TreeModelEvent of interest

Class VariableHeightLayoutCache, void treeNodesInserted(TreeModelEvent)

Invoked after nodes have been inserted into the tree.

e.path() returns the parent of the new nodes.

e.childIndices() returns the indices of the new nodes in ascending order. @param e the TreeModelEvent of interest

Class VariableHeightLayoutCache, void treeNodesRemoved(TreeModelEvent)

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree this method may only be invoked once for the root of the removed subtree not once for each individual set of siblings removed.

e.path() returns the former parent of the deleted nodes.

e.childIndices() returns the indices the nodes had before they were deleted in ascending order. @param e the TreeModelEvent of interest

Class VariableHeightLayoutCache, void treeStructureChanged(TreeModelEvent)

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

e.path() holds the path to the node.

e.childIndices() returns null. @param e the TreeModelEvent of interest