TreeView Class

TreeView Class

This Package | All Packages

Component
  |
  +--Control
    |
    +--TreeView
public class TreeView
extends Control

Windows TreeView common control.

Fields
Name Description
CUSTOM Topic under construction.
NONE Topic under construction.
TEXT Topic under construction.

Constructors
Name Description
TreeView() Constructs a new TreeView object.

Methods
Name Description
addChild(TreeNode parent, Object obj) Inserts an object into the TreeView as a child of the specified parent node.
clear() Deletes all nodes from the TreeView.
elements() Retrieves an IEnumerator interface for this TreeView object.
getIndent() Retrieves the offset, in pixels, of a TreeView item from its parent.
getReadOnly() Retrieves a boolean value that indicates whether the TreeView is read-only.
getRoot() Retrieves the root of the TreeView.
getShowButtons() Retrieves a boolean value that indicates whether the TreeView currently displays buttons next to parent nodes that have child items.
getShowLines() Retrieves a boolean value that indicates whether the TreeView currently displays lines linking child items to their corresponding parent items.
getShowRootLines() Retrieves a boolean value that indicates whether the TreeView has lines linking child items to the root of the heirarchy.
getSorted() Retrieves a boolean value that indicates whether the child items in the control are sorted.
setChildren(TreeNode parent, Object[] objs) Inserts an array of objects into the TreeView beneath the specified parent node.
setIndent(int val) Sets the indention level, in pixels, for child nodes.
setReadOnly(boolean val) Specifies whether the TreeView should be read-only.
setShowButtons(boolean val) Specifies whether the TreeView buttons should be displayed.
setShowLines(boolean val) Specifies whether the lines between nodes in the TreeView should be displayed.
setShowRootLines(boolean val) Specifies whether the lines linking child nodes to the TreeView's root node should be displayed.
setSorted(boolean val) Specifies whether the nodes in the TreeView should be sorted.

Fields

TreeView.CUSTOM

Syntax
public static final int CUSTOM;
Description
Topic under construction.

TreeView.NONE

Syntax
public static final int NONE;
Description
Topic under construction.

TreeView.TEXT

Syntax
public static final int TEXT;
Description
Topic under construction.

Constructors

TreeView.TreeView

Syntax
public TreeView();
Description

Constructs a new TreeView object.

Methods

TreeView.addChild

Syntax
public TreeNode addChild( TreeNode parent, Object obj );
Parameters
parent
Identifies the parent node beneath which the object will be inserted.
Object
The object to be inserted into the TreeView.
Return Value

Returns a TreeNode for the newly inserted object.

Description

Inserts an object into the TreeView as a child of the specified parent node.

TreeView.clear

Syntax
public void clear();
Description

Deletes all nodes from the TreeView.

TreeView.elements

Syntax
public IEnumerator elements();
Return Value

Returns an IEnumerator interface, which you use to iterate through the nodes in the TreeView.

Description

Retrieves an IEnumerator interface for this TreeView object.

TreeView.getIndent

Syntax
public int getIndent();
Return Value

Returns the amount of indentation, measured in pixels.

Description

Retrieves the offset, in pixels, of a TreeView item from its parent. For example, a return value of five (5), indicates that child nodes are indented five pixels to the right of parent nodes.

TreeView.getReadOnly

Syntax
public boolean getReadOnly();
Return Value

Returns true if the labels are read-only; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the TreeView is read-only. When a TreeView is read-only, the text of nodes in the tree cannot be edited.

TreeView.getRoot

Syntax
public TreeNode getRoot();
Return Value

Returns the root node of the TreeView.

Description

Retrieves the root of the TreeView.

TreeView.getShowButtons

Syntax
public boolean getShowButtons();
Return Value

Returns true if the TreeView is configured to display buttons for TreeView nodes that have children; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the TreeView currently displays buttons next to parent nodes that have child items.

TreeView.getShowLines

Syntax
public boolean getShowLines();
Return Value

Returns true, if the lines will be displayed; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the TreeView currently displays lines linking child items to their corresponding parent items.

TreeView.getShowRootLines

Syntax
public boolean getShowRootLines();
Return Value

Returns returns true, if the lines will be displayed; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the TreeView has lines linking child items to the root of the heirarchy.

TreeView.getSorted

Syntax
public boolean getSorted();
Return Value

Returns true if the items are sorted; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the child items in the control are sorted.

TreeView.setChildren

Syntax
public void setChildren( TreeNode parent, Object[] objs );
Parameters
parent
The parent beneath which the array of objects will be inserted.
objs
The array of objects to be inserted beneath the specified parent.
Description

Inserts an array of objects into the TreeView beneath the specified parent node.

TreeView.setIndent

Syntax
public void setIndent( int val );
Parameters
val
The indention level, in pixels, for child nodes.
Description

Sets the indention level, in pixels, for child nodes.

TreeView.setReadOnly

Syntax
public void setReadOnly( boolean val );
Parameters
val
If true, the labels of TreeView items are read-only. Otherwise, these labels can be edited by users.
Description

Specifies whether the TreeView should be read-only. When a TreeView is read-only, the text of nodes in the tree cannot be edited.

TreeView.setShowButtons

Syntax
public void setShowButtons( boolean val );
Parameters
val
If true, buttons appear next to parent nodes. Otherwise, no buttons appear.
Description

Specifies whether the TreeView buttons should be displayed.

TreeView.setShowLines

Syntax
public void setShowLines( boolean val );
Parameters
val
If true, the the lines that link child and parent items are displayed. Otherwise, the lines are not displayed.
Description

Specifies whether the lines between nodes in the TreeView should be displayed.

TreeView.setShowRootLines

Syntax
public void setShowRootLines( boolean val );
Parameters
val
If true, the TreeView displays the lines. Otherwise, the lines are not displayed.
Description

Specifies whether the lines linking child nodes to the TreeView's root node should be displayed.

TreeView.setSorted

Syntax
public void setSorted( boolean val );
Parameters
val
Set to true to sort the nodes in the TreeView; otherwise, set to false.
Description

Specifies whether the nodes in the TreeView should be sorted.