Java javax.swing JTree fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JTree fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JTree.

The text is from its open source code.

Subclass

javax.swing.JTree has subclasses.
Click this link to see all its subclasses.

Field

intexpandRow
The row to expand during DnD.

Constructor

JTree()
Returns a JTree with a sample model.
JTree(Object[] value)
Returns a JTree with each element of the specified array as the child of a new root node which is not displayed.
JTree(Vector value)
Returns a JTree with each element of the specified Vector as the child of a new root node which is not displayed.
JTree(Hashtable value)
Returns a JTree created from a Hashtable which does not display with root.
JTree(TreeNode root)
Returns a JTree with the specified TreeNode as its root, which displays the root node.
JTree(TreeModel newModel)
Returns an instance of JTree which displays the root node -- the tree is created using the specified data model.
JTree(TreeNode root, boolean asksAllowsChildren)
Returns a JTree with the specified TreeNode as its root, which displays the root node and which decides whether a node is a leaf node in the specified manner.

Method

Componentadd(Component comp)
Appends the specified component to the end of this container.
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
voidaddMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.
voidaddMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.
voidaddSelectionInterval(int index0, int index1)
Adds the specified rows (inclusive) to the selection.
voidaddTreeExpansionListener(TreeExpansionListener tel)
Adds a listener for TreeExpansion events.
voidaddTreeSelectionListener(TreeSelectionListener tsl)
Adds a listener for TreeSelection events.
voidaddTreeWillExpandListener(TreeWillExpandListener tel)
Adds a listener for TreeWillExpand events.
voidclearSelection()
Clears the selection.
voidcollapsePath(TreePath path)
Ensures that the node identified by the specified path is collapsed and viewable.
voidcollapseRow(int row)
Ensures that the node in the specified row is collapsed.
StringconvertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
Called by the renderers to convert the specified value to text.
voidexpandPath(TreePath path)
Ensures that the node identified by the specified path is expanded and viewable.
ActionMapgetActionMap()
Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding.
TreeCellEditorgetCellEditor()
Returns the editor used to edit entries in the tree.
TreeCellRenderergetCellRenderer()
Returns the current TreeCellRenderer that is rendering each cell.
ClassgetClass()
Returns the runtime class of this Object .
TreePathgetClosestPathForLocation(int x, int y)
Returns the path to the node that is closest to x,y.
EnumerationgetExpandedDescendants(TreePath parent)
Returns an Enumeration of the descendants of the path parent that are currently expanded.
FontgetFont()
Gets the font of this component.
InputMapgetInputMap(int condition)
Returns the InputMap that is used during condition.
ObjectgetLastSelectedPathComponent()
Returns the last path component of the selected path.
intgetLeadSelectionRow()
Returns the row index corresponding to the lead path.
intgetMaxSelectionRow()
Returns the largest selected row.
intgetMinSelectionRow()
Returns the smallest selected row.
TreeModelgetModel()
Returns the TreeModel that is providing the data.
StringgetName()
Gets the name of the component.
TreePathgetNextMatch(String prefix, int startingRow, Position.Bias bias)
Returns the TreePath to the next tree element that begins with a prefix.
RectanglegetPathBounds(TreePath path)
Returns the Rectangle that the specified node will be drawn into.
TreePathgetPathForLocation(int x, int y)
Returns the path for the node at the specified location.
TreePathgetPathForRow(int row)
Returns the path for the specified row.
RectanglegetRowBounds(int row)
Returns the Rectangle that the node at the specified row is drawn in.
intgetRowCount()
Returns the number of viewable nodes.
intgetRowForLocation(int x, int y)
Returns the row for the specified location.
intgetRowForPath(TreePath path)
Returns the row that displays the node identified by the specified path.
intgetRowHeight()
Returns the height of each row.
intgetSelectionCount()
Returns the number of nodes selected.
TreeSelectionModelgetSelectionModel()
Returns the model for selections.
TreePathgetSelectionPath()
Returns the path to the first selected node.
TreePath[]getSelectionPaths()
Returns the paths of all selected values.
int[]getSelectionRows()
Returns all of the currently selected rows.
booleangetShowsRootHandles()
Returns the value of the showsRootHandles property.
TransferHandlergetTransferHandler()
Gets the transferHandler property.
TreeUIgetUI()
Returns the L&F object that renders this component.
RectanglegetVisibleRect()
Returns the Component's "visible rectangle" - the intersection of this component's visible rectangle, new Rectangle(0, 0, getWidth(), getHeight()), and all of its ancestors' visible rectangles.
booleanisCollapsed(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.
booleanisCollapsed(int row)
Returns true if the node at the specified display row is collapsed.
booleanisEnabled()
Determines whether this component is enabled.
booleanisExpanded(TreePath path)
Returns true if the node identified by the path is currently expanded,
booleanisExpanded(int row)
Returns true if the node at the specified display row is currently expanded.
booleanisRootVisible()
Returns true if the root node of the tree is displayed.
booleanisRowSelected(int row)
Returns true if the node identified by row is selected.
booleanisVisible(TreePath path)
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.
voidmakeVisible(TreePath path)
Ensures that the node identified by path is currently viewable.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidremoveTreeExpansionListener(TreeExpansionListener tel)
Removes a listener for TreeExpansion events.
voidrepaint()
Repaints this component.
voidrepaint(Rectangle r)
Adds the specified region to the dirty region list if the component is showing.
voidrevalidate()
Supports deferred automatic layout.
voidscrollPathToVisible(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.
voidscrollRectToVisible(Rectangle aRect)
Forwards the scrollRectToVisible() message to the JComponent's parent.
voidscrollRowToVisible(int row)
Scrolls the item identified by row until it is displayed.
voidsetAutoscrolls(boolean autoscrolls)
Sets the autoscrolls property.
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBorder(Border border)
Sets the border of this component.
voidsetCellEditor(TreeCellEditor cellEditor)
Sets the cell editor.
voidsetCellRenderer(TreeCellRenderer x)
Sets the TreeCellRenderer that will be used to draw each cell.
voidsetDoubleBuffered(boolean aFlag)
Sets whether this component should use a buffer to paint.
voidsetDragEnabled(boolean b)
Turns on or off automatic drag handling.
voidsetDropMode(DropMode dropMode)
Sets the drop mode for this component.
voidsetEditable(boolean flag)
Determines whether the tree is editable.
voidsetFont(Font font)
Sets the font for this component.
voidsetForeground(Color fg)
Sets the foreground color of this component.
voidsetLayout(LayoutManager mgr)
Sets the layout manager for this container.
voidsetModel(TreeModel newModel)
Sets the TreeModel that will provide the data.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetRootVisible(boolean rootVisible)
Determines whether or not the root node from the TreeModel is visible.
voidsetRowHeight(int rowHeight)
Sets the height of each cell, in pixels.
voidsetSelectionModel(TreeSelectionModel selectionModel)
Sets the tree's selection model.
voidsetSelectionPath(TreePath path)
Selects the node identified by the specified path.
voidsetSelectionRow(int row)
Selects the node at the specified row in the display.
voidsetSelectionRows(int[] rows)
Selects the nodes corresponding to each of the specified rows in the display.
voidsetShowsRootHandles(boolean newValue)
Sets the value of the showsRootHandles property, which specifies whether the node handles should be displayed.
voidsetToggleClickCount(int clickCount)
Sets the number of mouse clicks before a node will expand or close.
voidsetToolTipText(String text)
Registers the text to display in a tool tip.
voidsetTransferHandler(TransferHandler newHandler)
Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop.
voidsetUI(TreeUI ui)
Sets the L&F object that renders this component.
voidsetVisible(boolean aFlag)
Makes the component visible or invisible.
voidsetVisibleRowCount(int newCount)
Sets the number of rows that are to be displayed.
StringtoString()
Returns a string representation of this component and its values.
voidupdateUI()
Notification from the UIManager that the L&F has changed.