Example usage for Java javax.swing JTree fields, constructors, methods, implement or subclass
The text is from its open source code.
int | expandRow The row to expand during DnD. |
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. |
Component | add(Component comp) Appends the specified component to the end of this container. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
void | addSelectionInterval(int index0, int index1) Adds the specified rows (inclusive) to the selection. |
void | addTreeExpansionListener(TreeExpansionListener tel) Adds a listener for TreeExpansion events. |
void | addTreeSelectionListener(TreeSelectionListener tsl) Adds a listener for TreeSelection events. |
void | addTreeWillExpandListener(TreeWillExpandListener tel) Adds a listener for TreeWillExpand events. |
void | clearSelection() Clears the selection. |
void | collapsePath(TreePath path) Ensures that the node identified by the specified path is collapsed and viewable. |
void | collapseRow(int row) Ensures that the node in the specified row is collapsed. |
String | convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) Called by the renderers to convert the specified value to text. |
void | expandPath(TreePath path) Ensures that the node identified by the specified path is expanded and viewable. |
ActionMap | getActionMap() Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. |
TreeCellEditor | getCellEditor() Returns the editor used to edit entries in the tree. |
TreeCellRenderer | getCellRenderer() Returns the current TreeCellRenderer that is rendering each cell. |
Class> | getClass() Returns the runtime class of this Object . |
TreePath | getClosestPathForLocation(int x, int y) Returns the path to the node that is closest to x,y. |
Enumeration | getExpandedDescendants(TreePath parent) Returns an Enumeration of the descendants of the path parent that are currently expanded. |
Font | getFont() Gets the font of this component. |
InputMap | getInputMap(int condition) Returns the InputMap that is used during condition . |
Object | getLastSelectedPathComponent() Returns the last path component of the selected path. |
int | getLeadSelectionRow() Returns the row index corresponding to the lead path. |
int | getMaxSelectionRow() Returns the largest selected row. |
int | getMinSelectionRow() Returns the smallest selected row. |
TreeModel | getModel() Returns the TreeModel that is providing the data. |
String | getName() Gets the name of the component. |
TreePath | getNextMatch(String prefix, int startingRow, Position.Bias bias) Returns the TreePath to the next tree element that begins with a prefix. |
Rectangle | getPathBounds(TreePath path) Returns the Rectangle that the specified node will be drawn into. |
TreePath | getPathForLocation(int x, int y) Returns the path for the node at the specified location. |
TreePath | getPathForRow(int row) Returns the path for the specified row. |
Rectangle | getRowBounds(int row) Returns the Rectangle that the node at the specified row is drawn in. |
int | getRowCount() Returns the number of viewable nodes. |
int | getRowForLocation(int x, int y) Returns the row for the specified location. |
int | getRowForPath(TreePath path) Returns the row that displays the node identified by the specified path. |
int | getRowHeight() Returns the height of each row. |
int | getSelectionCount() Returns the number of nodes selected. |
TreeSelectionModel | getSelectionModel() Returns the model for selections. |
TreePath | getSelectionPath() 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. |
boolean | getShowsRootHandles() Returns the value of the showsRootHandles property. |
TransferHandler | getTransferHandler() Gets the transferHandler property. |
TreeUI | getUI() Returns the L&F object that renders this component. |
Rectangle | getVisibleRect() 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. |
boolean | 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 | isCollapsed(int row) Returns true if the node at the specified display row is collapsed. |
boolean | isEnabled() Determines whether this component is enabled. |
boolean | isExpanded(TreePath path) Returns true if the node identified by the path is currently expanded, |
boolean | isExpanded(int row) Returns true if the node at the specified display row is currently expanded. |
boolean | isRootVisible() Returns true if the root node of the tree is displayed. |
boolean | isRowSelected(int row) Returns true if the node identified by row is selected. |
boolean | isVisible(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. |
void | makeVisible(TreePath path) Ensures that the node identified by path is currently viewable. |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | removeTreeExpansionListener(TreeExpansionListener tel) Removes a listener for TreeExpansion events. |
void | repaint() Repaints this component. |
void | repaint(Rectangle r) Adds the specified region to the dirty region list if the component is showing. |
void | revalidate() Supports deferred automatic layout. |
void | 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 | scrollRectToVisible(Rectangle aRect) Forwards the scrollRectToVisible() message to the JComponent 's parent. |
void | scrollRowToVisible(int row) Scrolls the item identified by row until it is displayed. |
void | setAutoscrolls(boolean autoscrolls) Sets the autoscrolls property. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setCellEditor(TreeCellEditor cellEditor) Sets the cell editor. |
void | setCellRenderer(TreeCellRenderer x) Sets the TreeCellRenderer that will be used to draw each cell. |
void | setDoubleBuffered(boolean aFlag) Sets whether this component should use a buffer to paint. |
void | setDragEnabled(boolean b) Turns on or off automatic drag handling. |
void | setDropMode(DropMode dropMode) Sets the drop mode for this component. |
void | setEditable(boolean flag) Determines whether the tree is editable. |
void | setFont(Font font) Sets the font for this component. |
void | setForeground(Color fg) Sets the foreground color of this component. |
void | setLayout(LayoutManager mgr) Sets the layout manager for this container. |
void | setModel(TreeModel newModel) Sets the TreeModel that will provide the data. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setRootVisible(boolean rootVisible) Determines whether or not the root node from the TreeModel is visible. |
void | setRowHeight(int rowHeight) Sets the height of each cell, in pixels. |
void | setSelectionModel(TreeSelectionModel selectionModel) Sets the tree's selection model. |
void | setSelectionPath(TreePath path) Selects the node identified by the specified path. |
void | setSelectionRow(int row) Selects the node at the specified row in the display. |
void | setSelectionRows(int[] rows) Selects the nodes corresponding to each of the specified rows in the display. |
void | setShowsRootHandles(boolean newValue) Sets the value of the showsRootHandles property, which specifies whether the node handles should be displayed. |
void | setToggleClickCount(int clickCount) Sets the number of mouse clicks before a node will expand or close. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(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. |
void | setUI(TreeUI ui) Sets the L&F object that renders this component. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
void | setVisibleRowCount(int newCount) Sets the number of rows that are to be displayed. |
String | toString() Returns a string representation of this component and its values. |
void | updateUI() Notification from the UIManager that the L&F has changed. |