| |
|
| java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTree
JTree | public class JTree extends JComponent implements Scrollable,Accessible(Code) | |
A control that displays a set of hierarchical data as an outline.
You can find task-oriented documentation and examples of using trees in
How to Use Trees,
a section in The Java Tutorial.
A specific node in a tree can be identified either by a
TreePath (an object
that encapsulates a node and all of its ancestors), or by its
display row, where each row in the display area displays one node.
An expanded node is a non-leaf node (as identified by
TreeModel.isLeaf(node) returning false) that will displays
its children when all its ancestors are expanded.
A collapsed
node is one which hides them. A hidden node is one which is
under a collapsed ancestor. All of a viewable nodes parents
are expanded, but may or may not be displayed. A displayed node
is both viewable and in the display area, where it can be seen.
The following JTree methods use "visible" to mean "displayed":
isRootVisible()
setRootVisible()
scrollPathToVisible()
scrollRowToVisible()
getVisibleRowCount()
setVisibleRowCount()
The next group of JTree methods use "visible" to mean
"viewable" (under an expanded parent):
isVisible()
makeVisible()
If you are interested in knowing when the selection changes implement
the TreeSelectionListener interface and add the instance
using the method addTreeSelectionListener .
valueChanged will be invoked when the
selection changes, that is if the user clicks twice on the same
node valueChanged will only be invoked once.
If you are interested in detecting either double-click events or when
a user clicks on a node, regardless of whether or not it was selected,
we recommend you do the following:
final JTree tree = ...;
MouseListener ml = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
if(selRow != -1) {
if(e.getClickCount() == 1) {
mySingleClick(selRow, selPath);
}
else if(e.getClickCount() == 2) {
myDoubleClick(selRow, selPath);
}
}
}
};
tree.addMouseListener(ml);
NOTE: This example obtains both the path and row, but you only need to
get the one you're interested in.
To use JTree to display compound nodes
(for example, nodes containing both
a graphic icon and text), subclass
TreeCellRenderer and use
JTree.setCellRenderer to tell the tree to use it. To edit such nodes,
subclass
TreeCellEditor and use
JTree.setCellEditor .
Like all JComponent classes, you can use
InputMap and
ActionMap to associate an
Action object with a
KeyStroke and execute the action under specified conditions.
Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.
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 JavaBeansTM
has been added to the java.beans package.
Please see
java.beans.XMLEncoder .
version: 1.203, 05/05/07 author: Rob Davis author: Ray Ryan author: Scott Violet |
Constructor Summary | |
public | JTree() Returns a JTree with a sample model. | public | 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. | public | 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. | public | JTree(Hashtable, ?> value) Returns a JTree created from a Hashtable
which does not display with root.
Each value-half of the key/value pairs in the HashTable
becomes a child of the new root node. | public | JTree(TreeNode root) Returns a JTree with the specified
TreeNode as its root,
which displays the root node. | public | 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. | public | JTree(TreeModel newModel) Returns an instance of JTree which displays the root node
-- the tree is created using the specified data model. |
Method Summary | |
public void | addSelectionInterval(int index0, int index1) Adds the specified rows (inclusive) to the selection. | public void | addSelectionPath(TreePath path) Adds the node identified by the specified TreePath
to the current selection. | public void | addSelectionPaths(TreePath[] paths) Adds each path in the array of paths to the current selection. | public void | addSelectionRow(int row) Adds the path at the specified row to the current selection. | public void | addSelectionRows(int[] rows) Adds the paths at each of the specified rows to the current selection. | public void | addTreeExpansionListener(TreeExpansionListener tel) Adds a listener for TreeExpansion events. | public void | addTreeSelectionListener(TreeSelectionListener tsl) Adds a listener for TreeSelection events. | public void | addTreeWillExpandListener(TreeWillExpandListener tel) Adds a listener for TreeWillExpand events. | public void | cancelEditing() Cancels the current editing session. | public void | clearSelection() Clears the selection. | protected void | clearToggledPaths() Clears the cache of toggled tree paths. | public void | collapsePath(TreePath path) Ensures that the node identified by the specified path is
collapsed and viewable. | public void | collapseRow(int row) Ensures that the node in the specified row is collapsed. | public 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. | protected static TreeModel | createTreeModel(Object value) Returns a TreeModel wrapping the specified object.
If the object is:
- an array of
Object s,
- a
Hashtable , or
- a
Vector
then a new root node is created with each of the incoming
objects as children. | protected TreeModelListener | createTreeModelListener() Creates and returns an instance of TreeModelHandler . | void | dndDone() Called to indicate to this component that DnD is done. | DropLocation | dropLocationForPoint(Point p) Calculates a drop location in this component, representing where a
drop at the given point should insert data. | public void | expandPath(TreePath path) Ensures that the node identified by the specified path is
expanded and viewable. | public void | expandRow(int row) Ensures that the node in the specified row is expanded and
viewable. | public void | fireTreeCollapsed(TreePath path) Notifies all listeners that have registered interest for
notification on this event type. | public void | fireTreeExpanded(TreePath path) Notifies all listeners that have registered interest for
notification on this event type. | public void | fireTreeWillCollapse(TreePath path) Notifies all listeners that have registered interest for
notification on this event type. | public void | fireTreeWillExpand(TreePath path) Notifies all listeners that have registered interest for
notification on this event type. | protected void | fireValueChanged(TreeSelectionEvent e) Notifies all listeners that have registered interest for
notification on this event type. | public AccessibleContext | getAccessibleContext() Gets the AccessibleContext associated with this JTree. | public TreePath | getAnchorSelectionPath() Returns the path identified as the anchor. | public TreeCellEditor | getCellEditor() Returns the editor used to edit entries in the tree. | public TreeCellRenderer | getCellRenderer() Returns the current TreeCellRenderer
that is rendering each cell. | public TreePath | getClosestPathForLocation(int x, int y) Returns the path to the node that is closest to x,y. | public int | getClosestRowForLocation(int x, int y) Returns the row to the node that is closest to x,y. | protected static TreeModel | getDefaultTreeModel() Creates and returns a sample TreeModel . | protected Enumeration<TreePath> | getDescendantToggledPaths(TreePath parent) Returns an Enumeration of TreePaths
that have been expanded that
are descendants of parent . | public boolean | getDragEnabled() Returns whether or not automatic drag handling is enabled. | final public DropLocation | getDropLocation() Returns the location that this component should visually indicate
as the drop location during a DnD operation over the component,
or
null if no location is to currently be shown. | final public DropMode | getDropMode() Returns the drop mode for this component. | public TreePath | getEditingPath() Returns the path to the element that is currently being edited. | public Enumeration<TreePath> | getExpandedDescendants(TreePath parent) Returns an Enumeration of the descendants of the
path parent that
are currently expanded. | public boolean | getExpandsSelectedPaths() Returns the expandsSelectedPaths property. | public boolean | getInvokesStopCellEditing() Returns the indicator that tells what happens when editing is
interrupted. | public Object | getLastSelectedPathComponent() Returns the last path component of the selected path. | public TreePath | getLeadSelectionPath() Returns the path identified as the lead. | public int | getLeadSelectionRow() Returns the row index corresponding to the lead path. | public int | getMaxSelectionRow() Returns the largest selected row. | public int | getMinSelectionRow() Returns the smallest selected row. | public TreeModel | getModel() Returns the TreeModel that is providing the data. | public TreePath | getNextMatch(String prefix, int startingRow, Position.Bias bias) Returns the TreePath to the next tree element that
begins with a prefix. | protected TreePath[] | getPathBetweenRows(int index0, int index1) Returns the paths (inclusive) between the specified rows. | public Rectangle | getPathBounds(TreePath path) Returns the Rectangle that the specified node will be drawn
into. | public TreePath | getPathForLocation(int x, int y) Returns the path for the node at the specified location. | public TreePath | getPathForRow(int row) Returns the path for the specified row. | public Dimension | getPreferredScrollableViewportSize() Returns the preferred display size of a JTree . | public Rectangle | getRowBounds(int row) Returns the Rectangle that the node at the specified row is
drawn in. | public int | getRowCount() Returns the number of viewable nodes. | public int | getRowForLocation(int x, int y) Returns the row for the specified location. | public int | getRowForPath(TreePath path) Returns the row that displays the node identified by the specified
path. | public int | getRowHeight() Returns the height of each row. | public int | getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) Returns the amount for a block increment, which is the height or
width of visibleRect , based on orientation .
Parameters: visibleRect - the view area visible within the viewport Parameters: orientation - either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL Parameters: direction - less than zero to scroll up/left,greater than zero for down/right. | public boolean | getScrollableTracksViewportHeight() Returns false to indicate that the height of the viewport does not
determine the height of the table, unless the preferred height
of the tree is smaller than the viewports height. | public boolean | getScrollableTracksViewportWidth() Returns false to indicate that the width of the viewport does not
determine the width of the table, unless the preferred width of
the tree is smaller than the viewports width. | public int | getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) Returns the amount to increment when scrolling. | public boolean | getScrollsOnExpand() Returns the value of the scrollsOnExpand property. | public int | getSelectionCount() Returns the number of nodes selected. | public TreeSelectionModel | getSelectionModel() Returns the model for selections. | public TreePath | getSelectionPath() Returns the path to the first selected node. | public TreePath[] | getSelectionPaths() Returns the paths of all selected values. | public int[] | getSelectionRows() Returns all of the currently selected rows. | public boolean | getShowsRootHandles() Returns the value of the showsRootHandles property. | public int | getToggleClickCount() Returns the number of mouse clicks needed to expand or close a node. | public String | getToolTipText(MouseEvent event) Overrides JComponent 's getToolTipText
method in order to allow
renderer's tips to be used if it has text set.
NOTE: For JTree to properly display tooltips of its
renderers, JTree must be a registered component with the
ToolTipManager . | public TreeExpansionListener[] | getTreeExpansionListeners() Returns an array of all the TreeExpansionListener s added
to this JTree with addTreeExpansionListener(). | public TreeSelectionListener[] | getTreeSelectionListeners() Returns an array of all the TreeSelectionListener s added
to this JTree with addTreeSelectionListener(). | public TreeWillExpandListener[] | getTreeWillExpandListeners() Returns an array of all the TreeWillExpandListener s added
to this JTree with addTreeWillExpandListener(). | public TreeUI | getUI() Returns the L&F object that renders this component. | public String | getUIClassID() Returns the name of the L&F class that renders this component. | public int | getVisibleRowCount() Returns the number of rows that are displayed in the display area. | public boolean | hasBeenExpanded(TreePath path) Returns true if the node identified by the path has ever been
expanded. | public 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. | public boolean | isCollapsed(int row) Returns true if the node at the specified display row is collapsed. | public boolean | isEditable() Returns true if the tree is editable. | public boolean | isEditing() Returns true if the tree is being edited. | public boolean | isExpanded(TreePath path) | public boolean | isExpanded(int row) Returns true if the node at the specified display row is currently
expanded. | public boolean | isFixedRowHeight() Returns true if the height of each display row is a fixed size. | public boolean | isLargeModel() Returns true if the tree is configured for a large model. | public boolean | isPathEditable(TreePath path) Returns isEditable . | public boolean | isPathSelected(TreePath path) Returns true if the item identified by the path is currently selected. | public boolean | isRootVisible() Returns true if the root node of the tree is displayed. | public boolean | isRowSelected(int row) Returns true if the node identified by row is selected. | public boolean | isSelectionEmpty() Returns true if the selection is currently empty. | public 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.
Otherwise, this method returns false. | public void | makeVisible(TreePath path) Ensures that the node identified by path is currently viewable. | protected String | paramString() Returns a string representation of this JTree .
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. | protected boolean | removeDescendantSelectedPaths(TreePath path, boolean includePath) Removes any paths in the selection that are descendants of
path . | void | removeDescendantSelectedPaths(TreeModelEvent e) Removes any paths from the selection model that are descendants of
the nodes identified by in e . | protected void | removeDescendantToggledPaths(Enumeration<TreePath> toRemove) Removes any descendants of the TreePaths in
toRemove
that have been expanded. | public void | removeSelectionInterval(int index0, int index1) Removes the specified rows (inclusive) from the selection. | public void | removeSelectionPath(TreePath path) Removes the node identified by the specified path from the current
selection. | public void | removeSelectionPaths(TreePath[] paths) Removes the nodes identified by the specified paths from the
current selection. | public void | removeSelectionRow(int row) Removes the row at the index row from the current
selection. | public void | removeSelectionRows(int[] rows) Removes the rows that are selected at each of the specified
rows. | public void | removeTreeExpansionListener(TreeExpansionListener tel) Removes a listener for TreeExpansion events. | public void | removeTreeSelectionListener(TreeSelectionListener tsl) Removes a TreeSelection listener. | public void | removeTreeWillExpandListener(TreeWillExpandListener tel) Removes a listener for TreeWillExpand events. | public 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. | public void | scrollRowToVisible(int row) Scrolls the item identified by row until it is displayed. | public void | setAnchorSelectionPath(TreePath newPath) Sets the path identified as the anchor.
The anchor is not maintained by JTree , rather the UI will
update it.
This is a bound property. | public void | setCellEditor(TreeCellEditor cellEditor) Sets the cell editor. | public void | setCellRenderer(TreeCellRenderer x) Sets the TreeCellRenderer that will be used to
draw each cell.
This is a bound property. | public void | setDragEnabled(boolean b) Turns on or off automatic drag handling. | Object | setDropLocation(TransferHandler.DropLocation location, Object state, boolean forDrop) Called to set or clear the drop location during a DnD operation.
In some cases, the component may need to use it's internal selection
temporarily to indicate the drop location. | final public void | setDropMode(DropMode dropMode) Sets the drop mode for this component. | public void | setEditable(boolean flag) Determines whether the tree is editable. | protected void | setExpandedState(TreePath path, boolean state) Sets the expanded state of this JTree .
If state is
true, all parents of path and path are marked as
expanded. | public void | setExpandsSelectedPaths(boolean newValue) Configures the expandsSelectedPaths property. | public void | setInvokesStopCellEditing(boolean newValue) Determines what happens when editing is interrupted by selecting
another node in the tree, a change in the tree's data, or by some
other means. | public void | setLargeModel(boolean newValue) Specifies whether the UI should use a large model.
(Not all UIs will implement this.) Fires a property change
for the LARGE_MODEL_PROPERTY.
This is a bound property. | public void | setLeadSelectionPath(TreePath newPath) Sets the path identifies as the lead. | public void | setModel(TreeModel newModel) Sets the TreeModel that will provide the data.
This is a bound property. | public void | setRootVisible(boolean rootVisible) Determines whether or not the root node from
the TreeModel is visible.
This is a bound property. | public void | setRowHeight(int rowHeight) Sets the height of each cell, in pixels. | public void | setScrollsOnExpand(boolean newValue) Sets the scrollsOnExpand property,
which determines whether the
tree might scroll to show previously hidden children.
If this property is true (the default),
when a node expands
the tree can use scrolling to make
the maximum possible number of the node's descendants visible.
In some look and feels, trees might not need to scroll when expanded;
those look and feels will ignore this property.
This is a bound property. | public void | setSelectionInterval(int index0, int index1) Selects the rows in the specified interval (inclusive). | public void | setSelectionModel(TreeSelectionModel selectionModel) Sets the tree's selection model. | public void | setSelectionPath(TreePath path) Selects the node identified by the specified path. | public void | setSelectionPaths(TreePath[] paths) Selects the nodes identified by the specified array of paths. | public void | setSelectionRow(int row) Selects the node at the specified row in the display. | public void | setSelectionRows(int[] rows) Selects the nodes corresponding to each of the specified rows
in the display. | public void | setShowsRootHandles(boolean newValue) Sets the value of the showsRootHandles property,
which specifies whether the node handles should be displayed.
The default value of this property depends on the constructor
used to create the JTree .
Some look and feels might not support handles;
they will ignore this property.
This is a bound property. | public void | setToggleClickCount(int clickCount) Sets the number of mouse clicks before a node will expand or close.
The default is two. | public void | setUI(TreeUI ui) Sets the L&F object that renders this component.
This is a bound property. | void | setUIProperty(String propertyName, Object value) | public void | setVisibleRowCount(int newCount) Sets the number of rows that are to be displayed.
This will only work if the tree is contained in a
JScrollPane ,
and will adjust the preferred size and size of that scrollpane.
This is a bound property. | public void | startEditingAtPath(TreePath path) Selects the node identified by the specified path and initiates
editing. | public boolean | stopEditing() Ends the current editing session. | public void | treeDidChange() Sent when the tree has changed enough that we need to resize
the bounds, but not enough that we need to remove the
expanded node set (e.g nodes were expanded or collapsed, or
nodes were inserted into the tree). | public void | updateUI() Notification from the UIManager that the L&F has changed. |
ANCHOR_SELECTION_PATH_PROPERTY | final public static String ANCHOR_SELECTION_PATH_PROPERTY(Code) | | Bound property name for anchor selection path.
since: 1.3 |
CELL_EDITOR_PROPERTY | final public static String CELL_EDITOR_PROPERTY(Code) | | Bound property name for cellEditor .
|
CELL_RENDERER_PROPERTY | final public static String CELL_RENDERER_PROPERTY(Code) | | Bound property name for cellRenderer .
|
EDITABLE_PROPERTY | final public static String EDITABLE_PROPERTY(Code) | | Bound property name for editable .
|
EXPANDS_SELECTED_PATHS_PROPERTY | final public static String EXPANDS_SELECTED_PATHS_PROPERTY(Code) | | Bound property name for expands selected paths property
since: 1.3 |
INVOKES_STOP_CELL_EDITING_PROPERTY | final public static String INVOKES_STOP_CELL_EDITING_PROPERTY(Code) | | Bound property name for messagesStopCellEditing .
|
LARGE_MODEL_PROPERTY | final public static String LARGE_MODEL_PROPERTY(Code) | | Bound property name for largeModel .
|
LEAD_SELECTION_PATH_PROPERTY | final public static String LEAD_SELECTION_PATH_PROPERTY(Code) | | Bound property name for leadSelectionPath .
since: 1.3 |
ROOT_VISIBLE_PROPERTY | final public static String ROOT_VISIBLE_PROPERTY(Code) | | Bound property name for rootVisible .
|
ROW_HEIGHT_PROPERTY | final public static String ROW_HEIGHT_PROPERTY(Code) | | Bound property name for rowHeight .
|
SCROLLS_ON_EXPAND_PROPERTY | final public static String SCROLLS_ON_EXPAND_PROPERTY(Code) | | Bound property name for scrollsOnExpand .
|
SELECTION_MODEL_PROPERTY | final public static String SELECTION_MODEL_PROPERTY(Code) | | Bound property name for selectionModel.
|
SHOWS_ROOT_HANDLES_PROPERTY | final public static String SHOWS_ROOT_HANDLES_PROPERTY(Code) | | Bound property name for showsRootHandles .
|
TOGGLE_CLICK_COUNT_PROPERTY | final public static String TOGGLE_CLICK_COUNT_PROPERTY(Code) | | Bound property name for toggleClickCount .
|
TREE_MODEL_PROPERTY | final public static String TREE_MODEL_PROPERTY(Code) | | Bound property name for treeModel .
|
VISIBLE_ROW_COUNT_PROPERTY | final public static String VISIBLE_ROW_COUNT_PROPERTY(Code) | | Bound property name for visibleRowCount .
|
cellEditor | protected transient TreeCellEditor cellEditor(Code) | | Editor for the entries. Default is null
(tree is not editable).
|
cellRenderer | protected transient TreeCellRenderer cellRenderer(Code) | | The cell used to draw nodes. If null , the UI uses a default
cellRenderer .
|
editable | protected boolean editable(Code) | | Is the tree editable? Default is false.
|
invokesStopCellEditing | protected boolean invokesStopCellEditing(Code) | | If true, when editing is to be stopped by way of selection changing,
data in tree changing or other means stopCellEditing
is invoked, and changes are saved. If false,
cancelCellEditing is invoked, and changes
are discarded. Default is false.
|
largeModel | protected boolean largeModel(Code) | | Is this tree a large model? This is a code-optimization setting.
A large model can be used when the cell height is the same for all
nodes. The UI will then cache very little information and instead
continually message the model. Without a large model the UI caches
most of the information, resulting in fewer method calls to the model.
This value is only a suggestion to the UI. Not all UIs will
take advantage of it. Default value is false.
|
rootVisible | protected boolean rootVisible(Code) | | True if the root node is displayed, false if its children are
the highest visible nodes.
|
rowHeight | protected int rowHeight(Code) | | Height to use for each display row. If this is <= 0 the renderer
determines the height for each row.
|
scrollsOnExpand | protected boolean scrollsOnExpand(Code) | | If true, when a node is expanded, as many of the descendants are
scrolled to be visible.
|
selectionModel | protected transient TreeSelectionModel selectionModel(Code) | | Models the set of selected nodes in this tree.
|
selectionRedirector | protected transient TreeSelectionRedirector selectionRedirector(Code) | | Creates a new event and passed it off the
selectionListeners .
|
showsRootHandles | protected boolean showsRootHandles(Code) | | True if handles are displayed at the topmost level of the tree.
A handle is a small icon that displays adjacent to the node which
allows the user to click once to expand or collapse the node. A
common interface shows a plus sign (+) for a node which can be
expanded and a minus sign (-) for a node which can be collapsed.
Handles are always shown for nodes below the topmost level.
If the rootVisible setting specifies that the root
node is to be displayed, then that is the only node at the topmost
level. If the root node is not displayed, then all of its
children are at the topmost level of the tree. Handles are
always displayed for nodes other than the topmost.
If the root node isn't visible, it is generally a good to make
this value true. Otherwise, the tree looks exactly like a list,
and users may not know that the "list entries" are actually
tree nodes.
See Also: JTree.rootVisible |
toggleClickCount | protected int toggleClickCount(Code) | | Number of mouse clicks before a node is expanded.
|
treeModel | protected transient TreeModel treeModel(Code) | | The model that defines the tree displayed by this object.
|
visibleRowCount | protected int visibleRowCount(Code) | | Number of rows to make visible at one time. This value is used for
the Scrollable interface. It determines the preferred
size of the display area.
|
JTree | public JTree(Object[] value)(Code) | | Returns a JTree with each element of the
specified array as the
child of a new root node which is not displayed.
By default, the tree defines a leaf node as any node without
children.
Parameters: value - an array of Object s See Also: DefaultTreeModel.asksAllowsChildren |
JTree | public JTree(Vector> value)(Code) | | Returns a JTree with each element of the specified
Vector as the
child of a new root node which is not displayed. By default, the
tree defines a leaf node as any node without children.
Parameters: value - a Vector See Also: DefaultTreeModel.asksAllowsChildren |
JTree | public JTree(Hashtable, ?> value)(Code) | | Returns a JTree created from a Hashtable
which does not display with root.
Each value-half of the key/value pairs in the HashTable
becomes a child of the new root node. By default, the tree defines
a leaf node as any node without children.
Parameters: value - a Hashtable See Also: DefaultTreeModel.asksAllowsChildren |
JTree | public JTree(TreeNode root)(Code) | | Returns a JTree with the specified
TreeNode as its root,
which displays the root node.
By default, the tree defines a leaf node as any node without children.
Parameters: root - a TreeNode object See Also: DefaultTreeModel.asksAllowsChildren |
JTree | public JTree(TreeNode root, boolean asksAllowsChildren)(Code) | | 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.
Parameters: root - a TreeNode object Parameters: asksAllowsChildren - if false, any node without children is a leaf node; if true, only nodes that do not allow children are leaf nodes See Also: DefaultTreeModel.asksAllowsChildren |
JTree | public JTree(TreeModel newModel)(Code) | | Returns an instance of JTree which displays the root node
-- the tree is created using the specified data model.
Parameters: newModel - the TreeModel to use as the data model |
addSelectionInterval | public void addSelectionInterval(int index0, int index1)(Code) | | Adds the specified rows (inclusive) to the selection. If the
specified indices are within the viewable set of rows, or bound
the viewable set of rows, then the specified indices are
constrained by the viewable set of rows. If the indices are not
within the viewable set of rows, or do not bound the viewable
set of rows, then the selection is unchanged. For example, if
the row count is
10 , and this method is invoked with
-1, 20 , then the specified indices bounds the viewable
range, and this is treated as if invoked with
0, 9 . On
the other hand, if this were invoked with
-10, -1 , then
the specified indices do not bound the viewable set of rows,
and the selection is unchanged.
The parameters are not order dependent. That is,
addSelectionInterval(x, y) is equivalent to
addSelectionInterval(y, x) .
Parameters: index0 - the first index in the range to add to the selection Parameters: index1 - the last index in the range to add to the selection |
addSelectionPath | public void addSelectionPath(TreePath path)(Code) | | Adds the node identified by the specified TreePath
to the current selection. If any component of the path isn't
viewable, and getExpandsSelectedPaths is true it is
made viewable.
Note that JTree does not allow duplicate nodes to
exist as children under the same parent -- each sibling must be
a unique object.
Parameters: path - the TreePath to add |
addSelectionPaths | public void addSelectionPaths(TreePath[] paths)(Code) | | Adds each path in the array of paths to the current selection. If
any component of any of the paths isn't viewable and
getExpandsSelectedPaths is true, it is
made viewable.
Note that JTree does not allow duplicate nodes to
exist as children under the same parent -- each sibling must be
a unique object.
Parameters: paths - an array of TreePath objects that specifiesthe nodes to add |
addSelectionRow | public void addSelectionRow(int row)(Code) | | Adds the path at the specified row to the current selection.
Parameters: row - an integer specifying the row of the node to add,where 0 is the first row in the display |
addSelectionRows | public void addSelectionRows(int[] rows)(Code) | | Adds the paths at each of the specified rows to the current selection.
Parameters: rows - an array of ints specifying the rows to add,where 0 indicates the first row in the display |
addTreeExpansionListener | public void addTreeExpansionListener(TreeExpansionListener tel)(Code) | | Adds a listener for TreeExpansion events.
Parameters: tel - a TreeExpansionListener that will be notified whena tree node is expanded or collapsed (a "negativeexpansion") |
addTreeSelectionListener | public void addTreeSelectionListener(TreeSelectionListener tsl)(Code) | | Adds a listener for TreeSelection events.
Parameters: tsl - the TreeSelectionListener that will be notified when a node is selected or deselected (a "negativeselection") |
addTreeWillExpandListener | public void addTreeWillExpandListener(TreeWillExpandListener tel)(Code) | | Adds a listener for TreeWillExpand events.
Parameters: tel - a TreeWillExpandListener that will be notified when a tree node will be expanded or collapsed (a "negativeexpansion") |
cancelEditing | public void cancelEditing()(Code) | | Cancels the current editing session. Has no effect if the
tree isn't being edited.
|
clearSelection | public void clearSelection()(Code) | | Clears the selection.
|
clearToggledPaths | protected void clearToggledPaths()(Code) | | Clears the cache of toggled tree paths. This does NOT send out
any TreeExpansionListener events.
|
collapsePath | public void collapsePath(TreePath path)(Code) | | Ensures that the node identified by the specified path is
collapsed and viewable.
Parameters: path - the TreePath identifying a node |
collapseRow | public void collapseRow(int row)(Code) | | Ensures that the node in the specified row is collapsed.
If row is < 0 or >= getRowCount this
will have no effect.
Parameters: row - an integer specifying a display row, where 0 is thefirst row in the display |
convertValueToText | public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)(Code) | | Called by the renderers to convert the specified value to
text. This implementation returns value.toString , ignoring
all other arguments. To control the conversion, subclass this
method and use any of the arguments you need.
Parameters: value - the Object to convert to text Parameters: selected - true if the node is selected Parameters: expanded - true if the node is expanded Parameters: leaf - true if the node is a leaf node Parameters: row - an integer specifying the node's display row, where 0 is the first row in the display Parameters: hasFocus - true if the node has the focus the String representation of the node's value |
createTreeModel | protected static TreeModel createTreeModel(Object value)(Code) | | Returns a TreeModel wrapping the specified object.
If the object is:
- an array of
Object s,
- a
Hashtable , or
- a
Vector
then a new root node is created with each of the incoming
objects as children. Otherwise, a new root is created with
a value of
"root" .
Parameters: value - the Object used as the foundation forthe TreeModel a TreeModel wrapping the specified object |
createTreeModelListener | protected TreeModelListener createTreeModelListener()(Code) | | Creates and returns an instance of TreeModelHandler .
The returned
object is responsible for updating the expanded state when the
TreeModel changes.
For more information on what expanded state means, see the
JTree description above.
|
dndDone | void dndDone()(Code) | | Called to indicate to this component that DnD is done.
Allows for us to cancel the expand timer.
|
dropLocationForPoint | DropLocation dropLocationForPoint(Point p)(Code) | | Calculates a drop location in this component, representing where a
drop at the given point should insert data.
Parameters: p - the point to calculate a drop location for the drop location, or null |
expandPath | public void expandPath(TreePath path)(Code) | | Ensures that the node identified by the specified path is
expanded and viewable. If the last item in the path is a
leaf, this will have no effect.
Parameters: path - the TreePath identifying a node |
expandRow | public void expandRow(int row)(Code) | | Ensures that the node in the specified row is expanded and
viewable.
If row is < 0 or >= getRowCount this
will have no effect.
Parameters: row - an integer specifying a display row, where 0 is thefirst row in the display |
fireTreeCollapsed | public void fireTreeCollapsed(TreePath path)(Code) | | Notifies all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the path parameter.
Parameters: path - the TreePath indicating the node that wascollapsed See Also: EventListenerList |
fireTreeExpanded | public void fireTreeExpanded(TreePath path)(Code) | | Notifies all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the path parameter.
Parameters: path - the TreePath indicating the node that wasexpanded See Also: EventListenerList |
fireTreeWillCollapse | public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException(Code) | | Notifies all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the path parameter.
Parameters: path - the TreePath indicating the node that wasexpanded See Also: EventListenerList |
fireTreeWillExpand | public void fireTreeWillExpand(TreePath path) throws ExpandVetoException(Code) | | Notifies all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the path parameter.
Parameters: path - the TreePath indicating the node that wasexpanded See Also: EventListenerList |
fireValueChanged | protected void fireValueChanged(TreeSelectionEvent e)(Code) | | Notifies all listeners that have registered interest for
notification on this event type.
Parameters: e - the TreeSelectionEvent to be fired;generated by theTreeSelectionModel when a node is selected or deselected See Also: EventListenerList |
getAccessibleContext | public AccessibleContext getAccessibleContext()(Code) | | Gets the AccessibleContext associated with this JTree.
For JTrees, the AccessibleContext takes the form of an
AccessibleJTree.
A new AccessibleJTree instance is created if necessary.
an AccessibleJTree that serves as the AccessibleContext of this JTree |
getAnchorSelectionPath | public TreePath getAnchorSelectionPath()(Code) | | Returns the path identified as the anchor.
path identified as the anchor since: 1.3 |
getCellEditor | public TreeCellEditor getCellEditor()(Code) | | Returns the editor used to edit entries in the tree.
the TreeCellEditor in use,or null if the tree cannot be edited |
getCellRenderer | public TreeCellRenderer getCellRenderer()(Code) | | Returns the current TreeCellRenderer
that is rendering each cell.
the TreeCellRenderer that is rendering each cell |
getClosestPathForLocation | public TreePath getClosestPathForLocation(int x, int y)(Code) | | Returns the path to the node that is closest to x,y. If
no nodes are currently viewable, or there is no model, returns
null , otherwise it always returns a valid path. To test if
the node is exactly at x, y, get the node's bounds and
test x, y against that.
Parameters: x - an integer giving the number of pixels horizontally fromthe left edge of the display area, minus any left margin Parameters: y - an integer giving the number of pixels vertically fromthe top of the display area, minus any top margin the TreePath for the node closest to that location,null if nothing is viewable or there is no model See Also: JTree.getPathForLocation See Also: JTree.getPathBounds |
getClosestRowForLocation | public int getClosestRowForLocation(int x, int y)(Code) | | Returns the row to the node that is closest to x,y. If no nodes
are viewable or there is no model, returns -1. Otherwise,
it always returns a valid row. To test if the returned object is
exactly at x, y, get the bounds for the node at the returned
row and test x, y against that.
Parameters: x - an integer giving the number of pixels horizontally fromthe left edge of the display area, minus any left margin Parameters: y - an integer giving the number of pixels vertically fromthe top of the display area, minus any top margin the row closest to the location, -1 if nothing isviewable or there is no model See Also: JTree.getRowForLocation See Also: JTree.getRowBounds |
getDefaultTreeModel | protected static TreeModel getDefaultTreeModel()(Code) | | Creates and returns a sample TreeModel .
Used primarily for beanbuilders to show something interesting.
the default TreeModel |
getDescendantToggledPaths | protected Enumeration<TreePath> getDescendantToggledPaths(TreePath parent)(Code) | | Returns an Enumeration of TreePaths
that have been expanded that
are descendants of parent .
|
getDragEnabled | public boolean getDragEnabled()(Code) | | Returns whether or not automatic drag handling is enabled.
the value of the dragEnabled property See Also: JTree.setDragEnabled since: 1.4 |
getDropLocation | final public DropLocation getDropLocation()(Code) | | Returns the location that this component should visually indicate
as the drop location during a DnD operation over the component,
or
null if no location is to currently be shown.
This method is not meant for querying the drop location
from a
TransferHandler , as the drop location is only
set after the
TransferHandler 's canImport
has returned and has allowed for the location to be shown.
When this property changes, a property change event with
name "dropLocation" is fired by the component.
the drop location See Also: JTree.setDropMode See Also: TransferHandler.canImport(TransferHandler.TransferSupport) since: 1.6 |
getDropMode | final public DropMode getDropMode()(Code) | | Returns the drop mode for this component.
the drop mode for this component See Also: JTree.setDropMode since: 1.6 |
getEditingPath | public TreePath getEditingPath()(Code) | | Returns the path to the element that is currently being edited.
the TreePath for the node being edited |
getExpandedDescendants | public Enumeration<TreePath> getExpandedDescendants(TreePath parent)(Code) | | Returns an Enumeration of the descendants of the
path parent that
are currently expanded. If parent is not currently
expanded, this will return null .
If you expand/collapse nodes while
iterating over the returned Enumeration
this may not return all
the expanded paths, or may return paths that are no longer expanded.
Parameters: parent - the path which is to be examined an Enumeration of the descendents of parent , or null ifparent is not currently expanded |
getExpandsSelectedPaths | public boolean getExpandsSelectedPaths()(Code) | | Returns the expandsSelectedPaths property.
true if selection changes result in the parent path beingexpanded since: 1.3 See Also: JTree.setExpandsSelectedPaths |
getInvokesStopCellEditing | public boolean getInvokesStopCellEditing()(Code) | | Returns the indicator that tells what happens when editing is
interrupted.
the indicator that tells what happens when editing is interrupted See Also: JTree.setInvokesStopCellEditing |
getLastSelectedPathComponent | public Object getLastSelectedPathComponent()(Code) | | Returns the last path component of the selected path. This is
a convenience method for
getSelectionModel().getSelectionPath().getLastPathComponent() .
This is typically only useful if the selection has one path.
the last path component of the selected path, ornull if nothing is selected See Also: TreePath.getLastPathComponent |
getLeadSelectionPath | public TreePath getLeadSelectionPath()(Code) | | Returns the path identified as the lead.
path identified as the lead |
getLeadSelectionRow | public int getLeadSelectionRow()(Code) | | Returns the row index corresponding to the lead path.
an integer giving the row index of the lead path,where 0 is the first row in the display; or -1if leadPath is null |
getMaxSelectionRow | public int getMaxSelectionRow()(Code) | | Returns the largest selected row. If the selection is empty, or
none of the selected paths are viewable,
-1 is returned.
the largest selected row |
getMinSelectionRow | public int getMinSelectionRow()(Code) | | Returns the smallest selected row. If the selection is empty, or
none of the selected paths are viewable,
-1 is returned.
the smallest selected row |
getModel | public TreeModel getModel()(Code) | | Returns the TreeModel that is providing the data.
the TreeModel that is providing the data |
getNextMatch | public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias)(Code) | | Returns the TreePath to the next tree element that
begins with a prefix. To handle the conversion of a
TreePath into a String, convertValueToText
is used.
Parameters: prefix - the string to test for a match Parameters: startingRow - the row for starting the search Parameters: bias - the search direction, either Position.Bias.Forward or Position.Bias.Backward. the TreePath of the next tree element thatstarts with the prefix; otherwise null exception: IllegalArgumentException - if prefix is nullor startingRow is out of bounds since: 1.4 |
getPathBetweenRows | protected TreePath[] getPathBetweenRows(int index0, int index1)(Code) | | Returns the paths (inclusive) between the specified rows. If
the specified indices are within the viewable set of rows, or
bound the viewable set of rows, then the indices are
constrained by the viewable set of rows. If the specified
indices are not within the viewable set of rows, or do not
bound the viewable set of rows, then an empty array is
returned. For example, if the row count is
10 , and this
method is invoked with
-1, 20 , then the specified
indices are constrained to the viewable set of rows, and this is
treated as if invoked with
0, 9 . On the other hand, if
this were invoked with
-10, -1 , then the specified
indices do not bound the viewable set of rows, and an empty
array is returned.
The parameters are not order dependent. That is,
getPathBetweenRows(x, y) is equivalent to
getPathBetweenRows(y, x) .
An empty array is returned if the row count is
0 , or
the specified indices do not bound the viewable set of rows.
Parameters: index0 - the first index in the range Parameters: index1 - the last index in the range the paths (inclusive) between the specified row indices |
getPathBounds | public Rectangle getPathBounds(TreePath path)(Code) | | Returns the Rectangle that the specified node will be drawn
into. Returns null if any component in the path is hidden
(under a collapsed parent).
Note:
This method returns a valid rectangle, even if the specified
node is not currently displayed.
Parameters: path - the TreePath identifying the node the Rectangle the node is drawn in,or null |
getPathForLocation | public TreePath getPathForLocation(int x, int y)(Code) | | Returns the path for the node at the specified location.
Parameters: x - an integer giving the number of pixels horizontally fromthe left edge of the display area, minus any left margin Parameters: y - an integer giving the number of pixels vertically fromthe top of the display area, minus any top margin the TreePath for the node at that location |
getPathForRow | public TreePath getPathForRow(int row)(Code) | | Returns the path for the specified row. If row is
not visible, or a
TreeUI has not been set, null
is returned.
Parameters: row - an integer specifying a row the TreePath to the specified node,null if row < 0 or row >= getRowCount() |
getPreferredScrollableViewportSize | public Dimension getPreferredScrollableViewportSize()(Code) | | Returns the preferred display size of a JTree . The height is
determined from getVisibleRowCount and the width
is the current preferred width.
a Dimension object containing the preferred size |
getRowBounds | public Rectangle getRowBounds(int row)(Code) | | Returns the Rectangle that the node at the specified row is
drawn in.
Parameters: row - the row to be drawn, where 0 is the first row in the display the Rectangle the node is drawn in |
getRowCount | public int getRowCount()(Code) | | Returns the number of viewable nodes. A node is viewable if all of its
parents are expanded. The root is only included in this count if
isRootVisible() is
true . This returns
0 if
the UI has not been set.
the number of viewable nodes |
getRowForLocation | public int getRowForLocation(int x, int y)(Code) | | Returns the row for the specified location.
Parameters: x - an integer giving the number of pixels horizontally fromthe left edge of the display area, minus any left margin Parameters: y - an integer giving the number of pixels vertically fromthe top of the display area, minus any top margin the row corresponding to the location, or -1 if thelocation is not within the bounds of a displayed cell See Also: JTree.getClosestRowForLocation |
getRowForPath | public int getRowForPath(TreePath path)(Code) | | Returns the row that displays the node identified by the specified
path.
Parameters: path - the TreePath identifying a node an integer specifying the display row, where 0 is the firstrow in the display, or -1 if any of the elements in pathare hidden under a collapsed parent. |
getRowHeight | public int getRowHeight()(Code) | | Returns the height of each row. If the returned value is less than
or equal to 0 the height for each row is determined by the
renderer.
|
getScrollableBlockIncrement | public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)(Code) | | Returns the amount for a block increment, which is the height or
width of visibleRect , based on orientation .
Parameters: visibleRect - the view area visible within the viewport Parameters: orientation - either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL Parameters: direction - less than zero to scroll up/left,greater than zero for down/right. the "block" increment for scrolling in the specified direction See Also: JScrollBar.setBlockIncrement(int) |
getScrollableTracksViewportHeight | public boolean getScrollableTracksViewportHeight()(Code) | | Returns false to indicate that the height of the viewport does not
determine the height of the table, unless the preferred height
of the tree is smaller than the viewports height. In other words:
ensure that the tree is never smaller than its viewport.
whether the tree should track the height of the viewport See Also: Scrollable.getScrollableTracksViewportHeight |
getScrollableTracksViewportWidth | public boolean getScrollableTracksViewportWidth()(Code) | | Returns false to indicate that the width of the viewport does not
determine the width of the table, unless the preferred width of
the tree is smaller than the viewports width. In other words:
ensure that the tree is never smaller than its viewport.
whether the tree should track the width of the viewport See Also: Scrollable.getScrollableTracksViewportWidth |
getScrollableUnitIncrement | public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)(Code) | | Returns the amount to increment when scrolling. The amount is
the height of the first displayed row that isn't completely in view
or, if it is totally displayed, the height of the next row in the
scrolling direction.
Parameters: visibleRect - the view area visible within the viewport Parameters: orientation - either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL Parameters: direction - less than zero to scroll up/left,greater than zero for down/right the "unit" increment for scrolling in the specified direction See Also: JScrollBar.setUnitIncrement(int) |
getScrollsOnExpand | public boolean getScrollsOnExpand()(Code) | | Returns the value of the scrollsOnExpand property.
the value of the scrollsOnExpand property |
getSelectionCount | public int getSelectionCount()(Code) | | Returns the number of nodes selected.
the number of nodes selected |
getSelectionModel | public TreeSelectionModel getSelectionModel()(Code) | | Returns the model for selections. This should always return a
non-null value. If you don't want to allow anything
to be selected
set the selection model to null , which forces an empty
selection model to be used.
See Also: JTree.setSelectionModel |
getSelectionPath | public TreePath getSelectionPath()(Code) | | Returns the path to the first selected node.
the TreePath for the first selected node,or null if nothing is currently selected |
getSelectionPaths | public TreePath[] getSelectionPaths()(Code) | | Returns the paths of all selected values.
an array of TreePath objects indicating the selectednodes, or null if nothing is currently selected |
getSelectionRows | public int[] getSelectionRows()(Code) | | Returns all of the currently selected rows. This method is simply
forwarded to the TreeSelectionModel .
If nothing is selected null or an empty array will
be returned, based on the TreeSelectionModel
implementation.
an array of integers that identifies all currently selected rowswhere 0 is the first row in the display |
getShowsRootHandles | public boolean getShowsRootHandles()(Code) | | Returns the value of the showsRootHandles property.
the value of the showsRootHandles property See Also: JTree.showsRootHandles |
getToggleClickCount | public int getToggleClickCount()(Code) | | Returns the number of mouse clicks needed to expand or close a node.
number of mouse clicks before node is expanded since: 1.3 |
getToolTipText | public String getToolTipText(MouseEvent event)(Code) | | Overrides JComponent 's getToolTipText
method in order to allow
renderer's tips to be used if it has text set.
NOTE: For JTree to properly display tooltips of its
renderers, JTree must be a registered component with the
ToolTipManager . This can be done by invoking
ToolTipManager.sharedInstance().registerComponent(tree) .
This is not done automatically!
Parameters: event - the MouseEvent that initiated the ToolTip display a string containing the tooltip or null if event is null |
getTreeExpansionListeners | public TreeExpansionListener[] getTreeExpansionListeners()(Code) | | Returns an array of all the TreeExpansionListener s added
to this JTree with addTreeExpansionListener().
all of the TreeExpansionListener s added or an emptyarray if no listeners have been added since: 1.4 |
getTreeSelectionListeners | public TreeSelectionListener[] getTreeSelectionListeners()(Code) | | Returns an array of all the TreeSelectionListener s added
to this JTree with addTreeSelectionListener().
all of the TreeSelectionListener s added or an emptyarray if no listeners have been added since: 1.4 |
getTreeWillExpandListeners | public TreeWillExpandListener[] getTreeWillExpandListeners()(Code) | | Returns an array of all the TreeWillExpandListener s added
to this JTree with addTreeWillExpandListener().
all of the TreeWillExpandListener s added or an emptyarray if no listeners have been added since: 1.4 |
getUI | public TreeUI getUI()(Code) | | Returns the L&F object that renders this component.
the TreeUI object that renders this component |
getVisibleRowCount | public int getVisibleRowCount()(Code) | | Returns the number of rows that are displayed in the display area.
the number of rows displayed |
hasBeenExpanded | public boolean hasBeenExpanded(TreePath path)(Code) | | Returns true if the node identified by the path has ever been
expanded.
true if the path has ever been expanded |
isCollapsed | public boolean isCollapsed(TreePath path)(Code) | | 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.
Parameters: path - the TreePath to check true if any of the nodes in the node's path are collapsed, false if all nodes in the path are expanded |
isCollapsed | public boolean isCollapsed(int row)(Code) | | Returns true if the node at the specified display row is collapsed.
Parameters: row - the row to check, where 0 is the first row in the display true if the node is currently collapsed, otherwise false |
isEditable | public boolean isEditable()(Code) | | Returns true if the tree is editable.
true if the tree is editable |
isEditing | public boolean isEditing()(Code) | | Returns true if the tree is being edited. The item that is being
edited can be obtained using getSelectionPath .
true if the user is currently editing a node See Also: JTree.getSelectionPath |
isExpanded | public boolean isExpanded(TreePath path)(Code) | | Returns true if the node identified by the path is currently expanded,
Parameters: path - the TreePath specifying the node to check false if any of the nodes in the node's path are collapsed, true if all nodes in the path are expanded |
isExpanded | public boolean isExpanded(int row)(Code) | | Returns true if the node at the specified display row is currently
expanded.
Parameters: row - the row to check, where 0 is the first row in the display true if the node is currently expanded, otherwise false |
isFixedRowHeight | public boolean isFixedRowHeight()(Code) | | Returns true if the height of each display row is a fixed size.
true if the height of each row is a fixed size |
isLargeModel | public boolean isLargeModel()(Code) | | Returns true if the tree is configured for a large model.
true if a large model is suggested See Also: JTree.largeModel |
isPathEditable | public boolean isPathEditable(TreePath path)(Code) | | Returns isEditable . This is invoked from the UI before
editing begins to insure that the given path can be edited. This
is provided as an entry point for subclassers to add filtered
editing without having to resort to creating a new editor.
true if every parent node and the node itself is editable See Also: JTree.isEditable |
isPathSelected | public boolean isPathSelected(TreePath path)(Code) | | Returns true if the item identified by the path is currently selected.
Parameters: path - a TreePath identifying a node true if the node is selected |
isRootVisible | public boolean isRootVisible()(Code) | | Returns true if the root node of the tree is displayed.
true if the root node of the tree is displayed See Also: JTree.rootVisible |
isRowSelected | public boolean isRowSelected(int row)(Code) | | Returns true if the node identified by row is selected.
Parameters: row - an integer specifying a display row, where 0 is the firstrow in the display true if the node is selected |
isSelectionEmpty | public boolean isSelectionEmpty()(Code) | | Returns true if the selection is currently empty.
true if the selection is currently empty |
isVisible | public boolean isVisible(TreePath path)(Code) | | 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.
Otherwise, this method returns false.
true if the node is viewable, otherwise false |
makeVisible | public void makeVisible(TreePath path)(Code) | | Ensures that the node identified by path is currently viewable.
Parameters: path - the TreePath to make visible |
paramString | protected String paramString()(Code) | | Returns a string representation of this JTree .
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null .
a string representation of this JTree . |
removeDescendantSelectedPaths | protected boolean removeDescendantSelectedPaths(TreePath path, boolean includePath)(Code) | | Removes any paths in the selection that are descendants of
path . If includePath is true and
path is selected, it will be removed from the selection.
true if a descendant was selected since: 1.3 |
removeDescendantSelectedPaths | void removeDescendantSelectedPaths(TreeModelEvent e)(Code) | | Removes any paths from the selection model that are descendants of
the nodes identified by in e .
|
removeDescendantToggledPaths | protected void removeDescendantToggledPaths(Enumeration<TreePath> toRemove)(Code) | | Removes any descendants of the TreePaths in
toRemove
that have been expanded.
Parameters: toRemove - an enumeration of the paths to remove; a value of null is ignored throws: ClassCastException - if toRemove contains anelement that is not a TreePath ; null values are ignored |
removeSelectionInterval | public void removeSelectionInterval(int index0, int index1)(Code) | | Removes the specified rows (inclusive) from the selection. If
the specified indices are within the viewable set of rows, or bound
the viewable set of rows, then the specified indices are constrained by
the viewable set of rows. If the specified indices are not within the
viewable set of rows, or do not bound the viewable set of rows, then
the selection is unchanged. For example, if the row count is
10 , and this method is invoked with
-1, 20 , then the
specified range bounds the viewable range, and this is treated as
if invoked with
0, 9 . On the other hand, if this were
invoked with
-10, -1 , then the specified range does not
bound the viewable set of rows, and the selection is unchanged.
The parameters are not order dependent. That is,
removeSelectionInterval(x, y) is equivalent to
removeSelectionInterval(y, x) .
Parameters: index0 - the first row to remove from the selection Parameters: index1 - the last row to remove from the selection |
removeSelectionPath | public void removeSelectionPath(TreePath path)(Code) | | Removes the node identified by the specified path from the current
selection.
Parameters: path - the TreePath identifying a node |
removeSelectionPaths | public void removeSelectionPaths(TreePath[] paths)(Code) | | Removes the nodes identified by the specified paths from the
current selection.
Parameters: paths - an array of TreePath objects thatspecifies the nodes to remove |
removeSelectionRow | public void removeSelectionRow(int row)(Code) | | Removes the row at the index row from the current
selection.
Parameters: row - the row to remove |
removeSelectionRows | public void removeSelectionRows(int[] rows)(Code) | | Removes the rows that are selected at each of the specified
rows.
Parameters: rows - an array of ints specifying display rows, where 0 is the first row in the display |
removeTreeExpansionListener | public void removeTreeExpansionListener(TreeExpansionListener tel)(Code) | | Removes a listener for TreeExpansion events.
Parameters: tel - the TreeExpansionListener to remove |
removeTreeSelectionListener | public void removeTreeSelectionListener(TreeSelectionListener tsl)(Code) | | Removes a TreeSelection listener.
Parameters: tsl - the TreeSelectionListener to remove |
removeTreeWillExpandListener | public void removeTreeWillExpandListener(TreeWillExpandListener tel)(Code) | | Removes a listener for TreeWillExpand events.
Parameters: tel - the TreeWillExpandListener to remove |
scrollPathToVisible | public void scrollPathToVisible(TreePath path)(Code) | | 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. Only works when this
JTree is contained in a JScrollPane .
Parameters: path - the TreePath identifying the node tobring into view |
scrollRowToVisible | public void scrollRowToVisible(int row)(Code) | | Scrolls the item identified by row until it is displayed. The minimum
of amount of scrolling necessary to bring the row into view
is performed. Only works when this JTree is contained in a
JScrollPane .
Parameters: row - an integer specifying the row to scroll, where 0 is thefirst row in the display |
setAnchorSelectionPath | public void setAnchorSelectionPath(TreePath newPath)(Code) | | Sets the path identified as the anchor.
The anchor is not maintained by JTree , rather the UI will
update it.
This is a bound property.
Parameters: newPath - the new anchor path since: 1.3 |
setCellEditor | public void setCellEditor(TreeCellEditor cellEditor)(Code) | | Sets the cell editor. A null value implies that the
tree cannot be edited. If this represents a change in the
cellEditor , the propertyChange
method is invoked on all listeners.
This is a bound property.
Parameters: cellEditor - the TreeCellEditor to use |
setCellRenderer | public void setCellRenderer(TreeCellRenderer x)(Code) | | Sets the TreeCellRenderer that will be used to
draw each cell.
This is a bound property.
Parameters: x - the TreeCellRenderer that is to render each cell |
setDragEnabled | public void setDragEnabled(boolean b)(Code) | | Turns on or off automatic drag handling. In order to enable automatic
drag handling, this property should be set to
true , and the
tree's
TransferHandler needs to be
non-null .
The default value of the
dragEnabled property is
false .
The job of honoring this property, and recognizing a user drag gesture,
lies with the look and feel implementation, and in particular, the tree's
TreeUI . When automatic drag handling is enabled, most look and
feels (including those that subclass
BasicLookAndFeel ) begin a
drag and drop operation whenever the user presses the mouse button over
an item and then moves the mouse a few pixels. Setting this property to
true can therefore have a subtle effect on how selections behave.
If a look and feel is used that ignores this property, you can still
begin a drag and drop operation by calling
exportAsDrag on the
tree's
TransferHandler .
Parameters: b - whether or not to enable automatic drag handling exception: HeadlessException - ifb is true andGraphicsEnvironment.isHeadless() returns true See Also: java.awt.GraphicsEnvironment.isHeadless See Also: JTree.getDragEnabled See Also: JTree.setTransferHandler See Also: TransferHandler since: 1.4 |
setDropLocation | Object setDropLocation(TransferHandler.DropLocation location, Object state, boolean forDrop)(Code) | | Called to set or clear the drop location during a DnD operation.
In some cases, the component may need to use it's internal selection
temporarily to indicate the drop location. To help facilitate this,
this method returns and accepts as a parameter a state object.
This state object can be used to store, and later restore, the selection
state. Whatever this method returns will be passed back to it in
future calls, as the state parameter. If it wants the DnD system to
continue storing the same state, it must pass it back every time.
Here's how this is used:
Let's say that on the first call to this method the component decides
to save some state (because it is about to use the selection to show
a drop index). It can return a state object to the caller encapsulating
any saved selection state. On a second call, let's say the drop location
is being changed to something else. The component doesn't need to
restore anything yet, so it simply passes back the same state object
to have the DnD system continue storing it. Finally, let's say this
method is messaged with null . This means DnD
is finished with this component for now, meaning it should restore
state. At this point, it can use the state parameter to restore
said state, and of course return null since there's
no longer anything to store.
Parameters: location - the drop location (as calculated bydropLocationForPoint ) or null if there's no longer a valid drop location Parameters: state - the state object saved earlier for this component,or null Parameters: forDrop - whether or not the method is being called because anactual drop occurred any saved state for this component, or null if none |
setDropMode | final public void setDropMode(DropMode dropMode)(Code) | | Sets the drop mode for this component. For backward compatibility,
the default for this property is DropMode.USE_SELECTION .
Usage of one of the other modes is recommended, however, for an
improved user experience. DropMode.ON , for instance,
offers similar behavior of showing items as selected, but does so without
affecting the actual selection in the tree.
JTree supports the following drop modes:
DropMode.USE_SELECTION
DropMode.ON
DropMode.INSERT
DropMode.ON_OR_INSERT
The drop mode is only meaningful if this component has a
TransferHandler that accepts drops.
Parameters: dropMode - the drop mode to use throws: IllegalArgumentException - if the drop mode is unsupportedor null See Also: JTree.getDropMode See Also: JTree.getDropLocation See Also: JTree.setTransferHandler See Also: TransferHandler since: 1.6 |
setEditable | public void setEditable(boolean flag)(Code) | | Determines whether the tree is editable. Fires a property
change event if the new setting is different from the existing
setting.
This is a bound property.
Parameters: flag - a boolean value, true if the tree is editable |
setExpandedState | protected void setExpandedState(TreePath path, boolean state)(Code) | | Sets the expanded state of this JTree .
If state is
true, all parents of path and path are marked as
expanded. If state is false, all parents of
path are marked EXPANDED, but path itself
is marked collapsed.
This will fail if a TreeWillExpandListener vetos it.
|
setExpandsSelectedPaths | public void setExpandsSelectedPaths(boolean newValue)(Code) | | Configures the expandsSelectedPaths property. If
true, any time the selection is changed, either via the
TreeSelectionModel , or the cover methods provided by
JTree , the TreePath s parents will be
expanded to make them visible (visible meaning the parent path is
expanded, not necessarily in the visible rectangle of the
JTree ). If false, when the selection
changes the nodes parent is not made visible (all its parents expanded).
This is useful if you wish to have your selection model maintain paths
that are not always visible (all parents expanded).
This is a bound property.
Parameters: newValue - the new value for expandsSelectedPaths since: 1.3 |
setInvokesStopCellEditing | public void setInvokesStopCellEditing(boolean newValue)(Code) | | Determines what happens when editing is interrupted by selecting
another node in the tree, a change in the tree's data, or by some
other means. Setting this property to true causes the
changes to be automatically saved when editing is interrupted.
Fires a property change for the INVOKES_STOP_CELL_EDITING_PROPERTY.
Parameters: newValue - true means that stopCellEditing is invoked when editing is interrupted, and data is saved; false means thatcancelCellEditing is invoked, and changes are lost |
setLargeModel | public void setLargeModel(boolean newValue)(Code) | | Specifies whether the UI should use a large model.
(Not all UIs will implement this.) Fires a property change
for the LARGE_MODEL_PROPERTY.
This is a bound property.
Parameters: newValue - true to suggest a large model to the UI See Also: JTree.largeModel |
setLeadSelectionPath | public void setLeadSelectionPath(TreePath newPath)(Code) | | Sets the path identifies as the lead. The lead may not be selected.
The lead is not maintained by JTree ,
rather the UI will update it.
This is a bound property.
Parameters: newPath - the new lead path since: 1.3 |
setModel | public void setModel(TreeModel newModel)(Code) | | Sets the TreeModel that will provide the data.
This is a bound property.
Parameters: newModel - the TreeModel that is to provide the data |
setRootVisible | public void setRootVisible(boolean rootVisible)(Code) | | Determines whether or not the root node from
the TreeModel is visible.
This is a bound property.
Parameters: rootVisible - true if the root node of the tree is to be displayed See Also: JTree.rootVisible |
setRowHeight | public void setRowHeight(int rowHeight)(Code) | | Sets the height of each cell, in pixels. If the specified value
is less than or equal to zero the current cell renderer is
queried for each row's height.
This is a bound property.
Parameters: rowHeight - the height of each cell, in pixels |
setScrollsOnExpand | public void setScrollsOnExpand(boolean newValue)(Code) | | Sets the scrollsOnExpand property,
which determines whether the
tree might scroll to show previously hidden children.
If this property is true (the default),
when a node expands
the tree can use scrolling to make
the maximum possible number of the node's descendants visible.
In some look and feels, trees might not need to scroll when expanded;
those look and feels will ignore this property.
This is a bound property.
Parameters: newValue - false to disable scrolling on expansion;true to enable it See Also: JTree.getScrollsOnExpand |
setSelectionInterval | public void setSelectionInterval(int index0, int index1)(Code) | | Selects the rows in the specified interval (inclusive). If
the specified indices are within the viewable set of rows, or bound
the viewable set of rows, then the specified rows are constrained by
the viewable set of rows. If the specified indices are not within the
viewable set of rows, or do not bound the viewable set of rows, then
the selection is cleared. For example, if the row count is
10 , and this method is invoked with
-1, 20 , then the
specified indices bounds the viewable range, and this is treated as
if invoked with
0, 9 . On the other hand, if this were
invoked with
-10, -1 , then the specified indices do not
bound the viewable set of rows, and the selection is cleared.
The parameters are not order dependent. That is,
setSelectionInterval(x, y) is equivalent to
setSelectionInterval(y, x) .
Parameters: index0 - the first index in the range to select Parameters: index1 - the last index in the range to select |
setSelectionModel | public void setSelectionModel(TreeSelectionModel selectionModel)(Code) | | Sets the tree's selection model. When a null value is
specified an empty
selectionModel is used, which does not allow selections.
This is a bound property.
Parameters: selectionModel - the TreeSelectionModel to use,or null to disable selections See Also: TreeSelectionModel |
setSelectionPath | public void setSelectionPath(TreePath path)(Code) | | Selects the node identified by the specified path. If any
component of the path is hidden (under a collapsed node), and
getExpandsSelectedPaths is true it is
exposed (made viewable).
Parameters: path - the TreePath specifying the node to select |
setSelectionPaths | public void setSelectionPaths(TreePath[] paths)(Code) | | Selects the nodes identified by the specified array of paths.
If any component in any of the paths is hidden (under a collapsed
node), and getExpandsSelectedPaths is true
it is exposed (made viewable).
Parameters: paths - an array of TreePath objects that specifiesthe nodes to select |
setSelectionRow | public void setSelectionRow(int row)(Code) | | Selects the node at the specified row in the display.
Parameters: row - the row to select, where 0 is the first row inthe display |
setSelectionRows | public void setSelectionRows(int[] rows)(Code) | | Selects the nodes corresponding to each of the specified rows
in the display. If a particular element of rows is
< 0 or >= getRowCount , it will be ignored.
If none of the elements
in rows are valid rows, the selection will
be cleared. That is it will be as if clearSelection
was invoked.
Parameters: rows - an array of ints specifying the rows to select,where 0 indicates the first row in the display |
setShowsRootHandles | public void setShowsRootHandles(boolean newValue)(Code) | | Sets the value of the showsRootHandles property,
which specifies whether the node handles should be displayed.
The default value of this property depends on the constructor
used to create the JTree .
Some look and feels might not support handles;
they will ignore this property.
This is a bound property.
Parameters: newValue - true if root handles should be displayed;otherwise, false See Also: JTree.showsRootHandles See Also: JTree.getShowsRootHandles |
setToggleClickCount | public void setToggleClickCount(int clickCount)(Code) | | Sets the number of mouse clicks before a node will expand or close.
The default is two.
This is a bound property.
since: 1.3 |
setUI | public void setUI(TreeUI ui)(Code) | | Sets the L&F object that renders this component.
This is a bound property.
Parameters: ui - the TreeUI L&F object See Also: UIDefaults.getUI |
setVisibleRowCount | public void setVisibleRowCount(int newCount)(Code) | | Sets the number of rows that are to be displayed.
This will only work if the tree is contained in a
JScrollPane ,
and will adjust the preferred size and size of that scrollpane.
This is a bound property.
Parameters: newCount - the number of rows to display |
startEditingAtPath | public void startEditingAtPath(TreePath path)(Code) | | Selects the node identified by the specified path and initiates
editing. The edit-attempt fails if the CellEditor
does not allow
editing for the specified item.
Parameters: path - the TreePath identifying a node |
stopEditing | public boolean stopEditing()(Code) | | Ends the current editing session.
(The DefaultTreeCellEditor
object saves any edits that are currently in progress on a cell.
Other implementations may operate differently.)
Has no effect if the tree isn't being edited.
Note:
To make edit-saves automatic whenever the user changes
their position in the tree, use
JTree.setInvokesStopCellEditing .
true if editing was in progress and is now stopped,false if editing was not in progress |
treeDidChange | public void treeDidChange()(Code) | | Sent when the tree has changed enough that we need to resize
the bounds, but not enough that we need to remove the
expanded node set (e.g nodes were expanded or collapsed, or
nodes were inserted into the tree). You should never have to
invoke this, the UI will invoke this as it needs to.
|
updateUI | public void updateUI()(Code) | | Notification from the UIManager that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager .
See Also: JComponent.updateUI |
Methods inherited from javax.swing.JComponent | void _paintImmediately(int x, int y, int w, int h)(Code)(Java Doc) public void addAncestorListener(AncestorListener listener)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) boolean alwaysOnTop()(Code)(Java Doc) boolean checkIfChildObscuredBySibling()(Code)(Java Doc) void clientPropertyChanged(Object key, Object oldValue, Object newValue)(Code)(Java Doc) void compWriteObjectNotify()(Code)(Java Doc) void componentInputMapChanged(ComponentInputMap inputMap)(Code)(Java Doc) final static void computeVisibleRect(Component c, Rectangle visibleRect)(Code)(Java Doc) public void computeVisibleRect(Rectangle visibleRect)(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public JToolTip createToolTip()(Code)(Java Doc) public void disable()(Code)(Java Doc) void dndDone()(Code)(Java Doc) TransferHandler.DropLocation dropLocationForPoint(Point p)(Code)(Java Doc) public void enable()(Code)(Java Doc) public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc) protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException(Code)(Java Doc) public AccessibleContext getAccessibleContext()(Code)(Java Doc) public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) final public ActionMap getActionMap()(Code)(Java Doc) final ActionMap getActionMap(boolean create)(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public AncestorListener[] getAncestorListeners()(Code)(Java Doc) public boolean getAutoscrolls()(Code)(Java Doc) public int getBaseline(int width, int height)(Code)(Java Doc) public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc) public Border getBorder()(Code)(Java Doc) public Rectangle getBounds(Rectangle rv)(Code)(Java Doc) final public Object getClientProperty(Object key)(Code)(Java Doc) protected Graphics getComponentGraphics(Graphics g)(Code)(Java Doc) public JPopupMenu getComponentPopupMenu()(Code)(Java Doc) public int getConditionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) boolean getCreatedDoubleBuffer()(Code)(Java Doc) public int getDebugGraphicsOptions()(Code)(Java Doc) public static Locale getDefaultLocale()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) static void getGraphicsInvoked(Component root)(Code)(Java Doc) public int getHeight()(Code)(Java Doc) public boolean getInheritsPopupMenu()(Code)(Java Doc) final public InputMap getInputMap(int condition)(Code)(Java Doc) final public InputMap getInputMap()(Code)(Java Doc) final InputMap getInputMap(int condition, boolean create)(Code)(Java Doc) public InputVerifier getInputVerifier()(Code)(Java Doc) public Insets getInsets()(Code)(Java Doc) public Insets getInsets(Insets insets)(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) public Point getLocation(Point rv)(Code)(Java Doc) static Set<KeyStroke> getManagingFocusBackwardTraversalKeys()(Code)(Java Doc) static Set<KeyStroke> getManagingFocusForwardTraversalKeys()(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public Component getNextFocusableComponent()(Code)(Java Doc) public Point getPopupLocation(MouseEvent event)(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public KeyStroke[] getRegisteredKeyStrokes()(Code)(Java Doc) public JRootPane getRootPane()(Code)(Java Doc) public Dimension getSize(Dimension rv)(Code)(Java Doc) public Point getToolTipLocation(MouseEvent event)(Code)(Java Doc) public String getToolTipText()(Code)(Java Doc) public String getToolTipText(MouseEvent event)(Code)(Java Doc) public Container getTopLevelAncestor()(Code)(Java Doc) public TransferHandler getTransferHandler()(Code)(Java Doc) public String getUIClassID()(Code)(Java Doc) public boolean getVerifyInputWhenFocusTarget()(Code)(Java Doc) public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc) public Rectangle getVisibleRect()(Code)(Java Doc) public int getWidth()(Code)(Java Doc) static byte getWriteObjCounter(JComponent comp)(Code)(Java Doc) public int getX()(Code)(Java Doc) public int getY()(Code)(Java Doc) public void grabFocus()(Code)(Java Doc) public boolean isDoubleBuffered()(Code)(Java Doc) public static boolean isLightweightComponent(Component c)(Code)(Java Doc) public boolean isManagingFocus()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isOptimizedDrawingEnabled()(Code)(Java Doc) boolean isPainting()(Code)(Java Doc) final public boolean isPaintingForPrint()(Code)(Java Doc) boolean isPaintingOrigin()(Code)(Java Doc) public boolean isPaintingTile()(Code)(Java Doc) public boolean isRequestFocusEnabled()(Code)(Java Doc) public boolean isValidateRoot()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) protected void paintBorder(Graphics g)(Code)(Java Doc) protected void paintChildren(Graphics g)(Code)(Java Doc) protected void paintComponent(Graphics g)(Code)(Java Doc) void paintForceDoubleBuffered(Graphics g)(Code)(Java Doc) public void paintImmediately(int x, int y, int w, int h)(Code)(Java Doc) public void paintImmediately(Rectangle r)(Code)(Java Doc) void paintToOffscreen(Graphics g, int x, int y, int w, int h, int maxX, int maxY)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void printBorder(Graphics g)(Code)(Java Doc) protected void printChildren(Graphics g)(Code)(Java Doc) protected void printComponent(Graphics g)(Code)(Java Doc) protected void processComponentKeyEvent(KeyEvent e)(Code)(Java Doc) protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc) boolean processKeyBindings(KeyEvent e, boolean pressed)(Code)(Java Doc) static boolean processKeyBindingsForAllComponents(KeyEvent e, Container container, boolean pressed)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) final public void putClientProperty(Object key, Object value)(Code)(Java Doc) boolean rectangleIsObscured(int x, int y, int width, int height)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void removeAncestorListener(AncestorListener listener)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void repaint(Rectangle r)(Code)(Java Doc) public boolean requestDefaultFocus()(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) public boolean requestFocus(boolean temporary)(Code)(Java Doc) public boolean requestFocusInWindow()(Code)(Java Doc) protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc) public void resetKeyboardActions()(Code)(Java Doc) public void reshape(int x, int y, int w, int h)(Code)(Java Doc) public void revalidate()(Code)(Java Doc) static Graphics safelyGetGraphics(Component c)(Code)(Java Doc) static Graphics safelyGetGraphics(Component c, Component root)(Code)(Java Doc) public void scrollRectToVisible(Rectangle aRect)(Code)(Java Doc) final public void setActionMap(ActionMap am)(Code)(Java Doc) public void setAlignmentX(float alignmentX)(Code)(Java Doc) public void setAlignmentY(float alignmentY)(Code)(Java Doc) public void setAutoscrolls(boolean autoscrolls)(Code)(Java Doc) public void setBackground(Color bg)(Code)(Java Doc) public void setBorder(Border border)(Code)(Java Doc) public void setComponentPopupMenu(JPopupMenu popup)(Code)(Java Doc) void setCreatedDoubleBuffer(boolean newValue)(Code)(Java Doc) public void setDebugGraphicsOptions(int debugOptions)(Code)(Java Doc) public static void setDefaultLocale(Locale l)(Code)(Java Doc) public void setDoubleBuffered(boolean aFlag)(Code)(Java Doc) Object setDropLocation(TransferHandler.DropLocation location, Object state, boolean forDrop)(Code)(Java Doc) public void setEnabled(boolean enabled)(Code)(Java Doc) public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc) public void setFont(Font font)(Code)(Java Doc) public void setForeground(Color fg)(Code)(Java Doc) public void setInheritsPopupMenu(boolean value)(Code)(Java Doc) final public void setInputMap(int condition, InputMap map)(Code)(Java Doc) public void setInputVerifier(InputVerifier inputVerifier)(Code)(Java Doc) public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc) public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc) public void setNextFocusableComponent(Component aComponent)(Code)(Java Doc) public void setOpaque(boolean isOpaque)(Code)(Java Doc) void setPaintingChild(Component paintingChild)(Code)(Java Doc) public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc) public void setRequestFocusEnabled(boolean requestFocusEnabled)(Code)(Java Doc) public void setToolTipText(String text)(Code)(Java Doc) public void setTransferHandler(TransferHandler newHandler)(Code)(Java Doc) protected void setUI(ComponentUI newUI)(Code)(Java Doc) void setUIProperty(String propertyName, Object value)(Code)(Java Doc) public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)(Code)(Java Doc) public void setVisible(boolean aFlag)(Code)(Java Doc) static void setWriteObjCounter(JComponent comp, byte count)(Code)(Java Doc) int shouldDebugGraphics()(Code)(Java Doc) void superProcessMouseMotionEvent(MouseEvent e)(Code)(Java Doc) public void unregisterKeyboardAction(KeyStroke aKeyStroke)(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void updateUI()(Code)(Java Doc)
|
Methods inherited from java.awt.Container | public Component add(Component comp)(Code)(Java Doc) public Component add(String name, Component comp)(Code)(Java Doc) public Component add(Component comp, int index)(Code)(Java Doc) public void add(Component comp, Object constraints)(Code)(Java Doc) public void add(Component comp, Object constraints, int index)(Code)(Java Doc) public synchronized void addContainerListener(ContainerListener l)(Code)(Java Doc) protected void addImpl(Component comp, Object constraints, int index)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public void addPropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc) public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc) public void applyComponentOrientation(ComponentOrientation o)(Code)(Java Doc) public boolean areFocusTraversalKeysSet(int id)(Code)(Java Doc) public int countComponents()(Code)(Java Doc) public void deliverEvent(Event e)(Code)(Java Doc) public void doLayout()(Code)(Java Doc) public Component findComponentAt(int x, int y)(Code)(Java Doc) public Component findComponentAt(Point p)(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public Component getComponent(int n)(Code)(Java Doc) public Component getComponentAt(int x, int y)(Code)(Java Doc) public Component getComponentAt(Point p)(Code)(Java Doc) public int getComponentCount()(Code)(Java Doc) public int getComponentZOrder(Component comp)(Code)(Java Doc) public Component[] getComponents()(Code)(Java Doc) public synchronized ContainerListener[] getContainerListeners()(Code)(Java Doc) public Set<AWTKeyStroke> getFocusTraversalKeys(int id)(Code)(Java Doc) public FocusTraversalPolicy getFocusTraversalPolicy()(Code)(Java Doc) public Insets getInsets()(Code)(Java Doc) public LayoutManager getLayout()(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public Point getMousePosition(boolean allowChildren) throws HeadlessException(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public Insets insets()(Code)(Java Doc) public void invalidate()(Code)(Java Doc) public boolean isAncestorOf(Component c)(Code)(Java Doc) public boolean isFocusCycleRoot(Container container)(Code)(Java Doc) public boolean isFocusCycleRoot()(Code)(Java Doc) final public boolean isFocusTraversalPolicyProvider()(Code)(Java Doc) public boolean isFocusTraversalPolicySet()(Code)(Java Doc) public void layout()(Code)(Java Doc) public void list(PrintStream out, int indent)(Code)(Java Doc) public void list(PrintWriter out, int indent)(Code)(Java Doc) public Component locate(int x, int y)(Code)(Java Doc) public Dimension minimumSize()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) public void paintComponents(Graphics g)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public Dimension preferredSize()(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printComponents(Graphics g)(Code)(Java Doc) protected void processContainerEvent(ContainerEvent e)(Code)(Java Doc) protected void processEvent(AWTEvent e)(Code)(Java Doc) public void remove(int index)(Code)(Java Doc) public void remove(Component comp)(Code)(Java Doc) public void removeAll()(Code)(Java Doc) public synchronized void removeContainerListener(ContainerListener l)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public void setComponentZOrder(Component comp, int index)(Code)(Java Doc) public void setFocusCycleRoot(boolean focusCycleRoot)(Code)(Java Doc) public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc) public void setFocusTraversalPolicy(FocusTraversalPolicy policy)(Code)(Java Doc) final public void setFocusTraversalPolicyProvider(boolean provider)(Code)(Java Doc) public void setFont(Font f)(Code)(Java Doc) public void setLayout(LayoutManager mgr)(Code)(Java Doc) public void transferFocusDownCycle()(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void validate()(Code)(Java Doc) protected void validateTree()(Code)(Java Doc)
|
Methods inherited from java.awt.Component | public boolean action(Event evt, Object what)(Code)(Java Doc) public void add(PopupMenu popup)(Code)(Java Doc) public synchronized void addComponentListener(ComponentListener l)(Code)(Java Doc) public synchronized void addFocusListener(FocusListener l)(Code)(Java Doc) public void addHierarchyBoundsListener(HierarchyBoundsListener l)(Code)(Java Doc) public void addHierarchyListener(HierarchyListener l)(Code)(Java Doc) public synchronized void addInputMethodListener(InputMethodListener l)(Code)(Java Doc) public synchronized void addKeyListener(KeyListener l)(Code)(Java Doc) public synchronized void addMouseListener(MouseListener l)(Code)(Java Doc) public synchronized void addMouseMotionListener(MouseMotionListener l)(Code)(Java Doc) public synchronized void addMouseWheelListener(MouseWheelListener l)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public synchronized void addPropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc) public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc) public void applyComponentOrientation(ComponentOrientation orientation)(Code)(Java Doc) public boolean areFocusTraversalKeysSet(int id)(Code)(Java Doc) public Rectangle bounds()(Code)(Java Doc) public int checkImage(Image image, ImageObserver observer)(Code)(Java Doc) public int checkImage(Image image, int width, int height, ImageObserver observer)(Code)(Java Doc) protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public boolean contains(Point p)(Code)(Java Doc) public Image createImage(ImageProducer producer)(Code)(Java Doc) public Image createImage(int width, int height)(Code)(Java Doc) public VolatileImage createVolatileImage(int width, int height)(Code)(Java Doc) public VolatileImage createVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException(Code)(Java Doc) public void deliverEvent(Event e)(Code)(Java Doc) public void disable()(Code)(Java Doc) final protected void disableEvents(long eventsToDisable)(Code)(Java Doc) final public void dispatchEvent(AWTEvent e)(Code)(Java Doc) public void doLayout()(Code)(Java Doc) public void enable()(Code)(Java Doc) public void enable(boolean b)(Code)(Java Doc) final protected void enableEvents(long eventsToEnable)(Code)(Java Doc) public void enableInputMethods(boolean enable)(Code)(Java Doc) protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)(Code)(Java Doc) protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc) protected void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, byte oldValue, byte newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, short oldValue, short newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, long oldValue, long newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, float oldValue, float newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, double oldValue, double newValue)(Code)(Java Doc) public AccessibleContext getAccessibleContext()(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public Color getBackground()(Code)(Java Doc) public int getBaseline(int width, int height)(Code)(Java Doc) public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc) public Rectangle getBounds()(Code)(Java Doc) public Rectangle getBounds(Rectangle rv)(Code)(Java Doc) public ColorModel getColorModel()(Code)(Java Doc) public Component getComponentAt(int x, int y)(Code)(Java Doc) public Component getComponentAt(Point p)(Code)(Java Doc) public synchronized ComponentListener[] getComponentListeners()(Code)(Java Doc) public ComponentOrientation getComponentOrientation()(Code)(Java Doc) public Cursor getCursor()(Code)(Java Doc) public synchronized DropTarget getDropTarget()(Code)(Java Doc) public Container getFocusCycleRootAncestor()(Code)(Java Doc) public synchronized FocusListener[] getFocusListeners()(Code)(Java Doc) public Set<AWTKeyStroke> getFocusTraversalKeys(int id)(Code)(Java Doc) public boolean getFocusTraversalKeysEnabled()(Code)(Java Doc) public Font getFont()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Color getForeground()(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) public GraphicsConfiguration getGraphicsConfiguration()(Code)(Java Doc) public int getHeight()(Code)(Java Doc) public synchronized HierarchyBoundsListener[] getHierarchyBoundsListeners()(Code)(Java Doc) public synchronized HierarchyListener[] getHierarchyListeners()(Code)(Java Doc) public boolean getIgnoreRepaint()(Code)(Java Doc) public InputContext getInputContext()(Code)(Java Doc) public synchronized InputMethodListener[] getInputMethodListeners()(Code)(Java Doc) public InputMethodRequests getInputMethodRequests()(Code)(Java Doc) public synchronized KeyListener[] getKeyListeners()(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) public Locale getLocale()(Code)(Java Doc) public Point getLocation()(Code)(Java Doc) public Point getLocation(Point rv)(Code)(Java Doc) public Point getLocationOnScreen()(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public synchronized MouseListener[] getMouseListeners()(Code)(Java Doc) public synchronized MouseMotionListener[] getMouseMotionListeners()(Code)(Java Doc) public Point getMousePosition() throws HeadlessException(Code)(Java Doc) public synchronized MouseWheelListener[] getMouseWheelListeners()(Code)(Java Doc) public String getName()(Code)(Java Doc) public Container getParent()(Code)(Java Doc) public ComponentPeer getPeer()(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public synchronized PropertyChangeListener[] getPropertyChangeListeners()(Code)(Java Doc) public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)(Code)(Java Doc) public Dimension getSize()(Code)(Java Doc) public Dimension getSize(Dimension rv)(Code)(Java Doc) public Toolkit getToolkit()(Code)(Java Doc) final public Object getTreeLock()(Code)(Java Doc) public int getWidth()(Code)(Java Doc) public int getX()(Code)(Java Doc) public int getY()(Code)(Java Doc) public boolean gotFocus(Event evt, Object what)(Code)(Java Doc) public boolean handleEvent(Event evt)(Code)(Java Doc) public boolean hasFocus()(Code)(Java Doc) public void hide()(Code)(Java Doc) public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)(Code)(Java Doc) public boolean inside(int x, int y)(Code)(Java Doc) public void invalidate()(Code)(Java Doc) public boolean isBackgroundSet()(Code)(Java Doc) public boolean isCursorSet()(Code)(Java Doc) public boolean isDisplayable()(Code)(Java Doc) public boolean isDoubleBuffered()(Code)(Java Doc) public boolean isEnabled()(Code)(Java Doc) public boolean isFocusCycleRoot(Container container)(Code)(Java Doc) public boolean isFocusOwner()(Code)(Java Doc) public boolean isFocusTraversable()(Code)(Java Doc) public boolean isFocusable()(Code)(Java Doc) public boolean isFontSet()(Code)(Java Doc) public boolean isForegroundSet()(Code)(Java Doc) public boolean isLightweight()(Code)(Java Doc) public boolean isMaximumSizeSet()(Code)(Java Doc) public boolean isMinimumSizeSet()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isPreferredSizeSet()(Code)(Java Doc) public boolean isShowing()(Code)(Java Doc) public boolean isValid()(Code)(Java Doc) public boolean isVisible()(Code)(Java Doc) public boolean keyDown(Event evt, int key)(Code)(Java Doc) public boolean keyUp(Event evt, int key)(Code)(Java Doc) public void layout()(Code)(Java Doc) public void list()(Code)(Java Doc) public void list(PrintStream out)(Code)(Java Doc) public void list(PrintStream out, int indent)(Code)(Java Doc) public void list(PrintWriter out)(Code)(Java Doc) public void list(PrintWriter out, int indent)(Code)(Java Doc) public Component locate(int x, int y)(Code)(Java Doc) public Point location()(Code)(Java Doc) public boolean lostFocus(Event evt, Object what)(Code)(Java Doc) public Dimension minimumSize()(Code)(Java Doc) public boolean mouseDown(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseDrag(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseEnter(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseExit(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseMove(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseUp(Event evt, int x, int y)(Code)(Java Doc) public void move(int x, int y)(Code)(Java Doc) public void nextFocus()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) public void paintAll(Graphics g)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public boolean postEvent(Event e)(Code)(Java Doc) public Dimension preferredSize()(Code)(Java Doc) public boolean prepareImage(Image image, ImageObserver observer)(Code)(Java Doc) public boolean prepareImage(Image image, int width, int height, ImageObserver observer)(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void processComponentEvent(ComponentEvent e)(Code)(Java Doc) protected void processEvent(AWTEvent e)(Code)(Java Doc) protected void processFocusEvent(FocusEvent e)(Code)(Java Doc) protected void processHierarchyBoundsEvent(HierarchyEvent e)(Code)(Java Doc) protected void processHierarchyEvent(HierarchyEvent e)(Code)(Java Doc) protected void processInputMethodEvent(InputMethodEvent e)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseWheelEvent(MouseWheelEvent e)(Code)(Java Doc) public void remove(MenuComponent popup)(Code)(Java Doc) public synchronized void removeComponentListener(ComponentListener l)(Code)(Java Doc) public synchronized void removeFocusListener(FocusListener l)(Code)(Java Doc) public void removeHierarchyBoundsListener(HierarchyBoundsListener l)(Code)(Java Doc) public void removeHierarchyListener(HierarchyListener l)(Code)(Java Doc) public synchronized void removeInputMethodListener(InputMethodListener l)(Code)(Java Doc) public synchronized void removeKeyListener(KeyListener l)(Code)(Java Doc) public synchronized void removeMouseListener(MouseListener l)(Code)(Java Doc) public synchronized void removeMouseMotionListener(MouseMotionListener l)(Code)(Java Doc) public synchronized void removeMouseWheelListener(MouseWheelListener l)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public synchronized void removePropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc) public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc) public void repaint()(Code)(Java Doc) public void repaint(long tm)(Code)(Java Doc) public void repaint(int x, int y, int width, int height)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) protected boolean requestFocus(boolean temporary)(Code)(Java Doc) public boolean requestFocusInWindow()(Code)(Java Doc) protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc) public void reshape(int x, int y, int width, int height)(Code)(Java Doc) public void resize(int width, int height)(Code)(Java Doc) public void resize(Dimension d)(Code)(Java Doc) public void setBackground(Color c)(Code)(Java Doc) public void setBounds(int x, int y, int width, int height)(Code)(Java Doc) public void setBounds(Rectangle r)(Code)(Java Doc) public void setComponentOrientation(ComponentOrientation o)(Code)(Java Doc) public void setCursor(Cursor cursor)(Code)(Java Doc) public synchronized void setDropTarget(DropTarget dt)(Code)(Java Doc) public void setEnabled(boolean b)(Code)(Java Doc) public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc) public void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)(Code)(Java Doc) public void setFocusable(boolean focusable)(Code)(Java Doc) public void setFont(Font f)(Code)(Java Doc) public void setForeground(Color c)(Code)(Java Doc) public void setIgnoreRepaint(boolean ignoreRepaint)(Code)(Java Doc) public void setLocale(Locale l)(Code)(Java Doc) public void setLocation(int x, int y)(Code)(Java Doc) public void setLocation(Point p)(Code)(Java Doc) public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc) public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc) public void setName(String name)(Code)(Java Doc) public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc) public void setSize(int width, int height)(Code)(Java Doc) public void setSize(Dimension d)(Code)(Java Doc) public void setVisible(boolean b)(Code)(Java Doc) public void show()(Code)(Java Doc) public void show(boolean b)(Code)(Java Doc) public Dimension size()(Code)(Java Doc) public String toString()(Code)(Java Doc) public void transferFocus()(Code)(Java Doc) public void transferFocusBackward()(Code)(Java Doc) public void transferFocusUpCycle()(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void validate()(Code)(Java Doc)
|
|
|
|