| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Nested Class Summary | |
protected class |
|
static class | |
protected static class |
|
protected class |
|
protected class |
|
Nested classes/interfaces inherited from class javax.swing.JComponent | |
JComponent.AccessibleJComponent | |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer | |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy | |
Field Summary | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
static String | |
protected TreeCellEditor | |
protected TreeCellRenderer | |
protected boolean | |
protected boolean | |
protected boolean | |
protected boolean | |
protected int | |
protected boolean | |
protected TreeSelectionModel | |
protected JTree.TreeSelectionRedirector |
|
protected boolean | |
protected int | |
protected TreeModel | |
protected TreeModelListener |
|
protected int | |
Fields inherited from class javax.swing.JComponent | |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, accessibleContext, listenerList, ui | |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH | |
Constructor Summary | |
| |
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void | |
protected void | |
void |
|
void |
|
String |
|
protected static TreeModel |
|
protected TreeModelListener |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
AccessibleContext |
|
TreePath | |
TreeCellEditor | |
TreeCellRenderer | |
TreePath |
|
int |
|
protected static TreeModel |
|
protected Enumeration |
|
boolean |
|
TreePath | |
Enumeration |
|
boolean | |
boolean | |
Object | |
TreePath | |
int | |
int | |
int | |
TreeModel |
|
TreePath |
|
protected TreePath[] |
|
Rectangle |
|
TreePath |
|
TreePath |
|
Dimension |
|
Rectangle |
|
int | |
int |
|
int |
|
int | |
int |
|
boolean | |
boolean | |
int |
|
boolean | |
int | |
TreeSelectionModel | |
TreePath | |
TreePath[] | |
int[] | |
boolean | |
int | |
TreeExpansionListener[] |
|
TreeSelectionListener[] |
|
TreeWillExpandListener[] |
|
TreeUI |
|
String |
|
int | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean | |
boolean |
|
boolean |
|
boolean | |
boolean | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean | |
boolean | |
void |
|
String |
|
protected boolean |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
boolean | |
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | |
public static final String ANCHOR_SELECTION_PATH_PROPERTY
- Field Value:
- "anchorSelectionPath"
- Since:
- 1.3
public static final String EXPANDS_SELECTED_PATHS_PROPERTY
- Field Value:
- "expandsSelectedPaths"
- Since:
- 1.3
public static final String INVOKES_STOP_CELL_EDITING_PROPERTY
- Field Value:
- "invokesStopCellEditing"
public static final String LEAD_SELECTION_PATH_PROPERTY
- Field Value:
- "leadSelectionPath"
- Since:
- 1.3
public static final String SCROLLS_ON_EXPAND_PROPERTY
- Field Value:
- "scrollsOnExpand"
public static final String SELECTION_MODEL_PROPERTY
- Field Value:
- "selectionModel"
public static final String SHOWS_ROOT_HANDLES_PROPERTY
- Field Value:
- "showsRootHandles"
public static final String TOGGLE_CLICK_COUNT_PROPERTY
- Field Value:
- "toggleClickCount"
public static final String VISIBLE_ROW_COUNT_PROPERTY
- Field Value:
- "visibleRowCount"
protected JTree.TreeSelectionRedirector selectionRedirector
Redirects TreeSelectionEvents so that the source is this JTree.
protected TreeModelListener treeModelListener
Handles TreeModelEvents to update the expandedState.
public JTree(Object[] value)
Creates a newJTreeobject.
- Parameters:
value- the initial nodes in the tree
public JTree(Hashtable value)
Creates a newJTreeobject.
- Parameters:
value- the initial nodes in the tree
public JTree(Vector value)
Creates a newJTreeobject.
- Parameters:
value- the initial nodes in the tree
public void addTreeExpansionListener(TreeExpansionListener listener)
Adds aTreeExpansionListenerobject to the tree.
- Parameters:
listener- the listener to add
public void addTreeSelectionListener(TreeSelectionListener listener)
Adds aTreeSelctionListenerobject to the tree.
- Parameters:
listener- the listener to add
public void addTreeWillExpandListener(TreeWillExpandListener listener)
Adds aTreeWillExpandListenerobject to the tree.
- Parameters:
listener- the listener to add
public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
Converts the specified value to a String. This is used by the renderers of this JTree and its nodes. This implementation simply returnsvalue.toString()and ignores all other parameters. Subclass this method to control the conversion.
- Parameters:
value- the value that is converted to a Stringselected- indicates if that value is selected or notexpanded- indicates if that value is expanded or notleaf- indicates if that value is a leaf node or notrow- the row of the nodehasFocus- indicates if that node has focus or not
protected static TreeModel createTreeModel(Object value)
Creates a newTreeModelobject.
- Parameters:
value- the values stored in the model
protected TreeModelListener createTreeModelListener()
Creates and returns an instance ofJTree.TreeModelHandler.
- Returns:
- an instance of
JTree.TreeModelHandler
public void fireTreeCollapsed(TreePath path)
Notifies all listeners that the tree was collapsed.
- Parameters:
path- the path to the node that was collapsed
public void fireTreeExpanded(TreePath path)
Notifies all listeners that the tree was expanded.
- Parameters:
path- the path to the node that was expanded
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
Notifies all listeners that the tree will collapse.
- Parameters:
path- the path to the node that will collapse
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
Notifies all listeners that the tree will expand.
- Parameters:
path- the path to the node that will expand
protected void fireValueChanged(TreeSelectionEvent event)
Notifies all listeners when the selection of the tree changed.
- Parameters:
event- the event to send
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with thisJTree.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface JComponent
- Returns:
- the associated context
protected static TreeModel getDefaultTreeModel()
Returns a sample TreeModel that can be used in a JTree. This can be used in Bean- or GUI-Builders to show something interesting.
- Returns:
- a sample TreeModel that can be used in a JTree
public boolean getDragEnabled()
Return the value of thedragEnabledproperty.
- Returns:
- the value
- Since:
- 1.4
public Enumeration getExpandedDescendants(TreePath path)
Returns all TreePath objects which are a descendants of the given path and are exapanded at the moment of the execution of this method. If the state of any node is beeing toggled while this method is executing this change may be left unaccounted.
- Parameters:
path- The parent of this request
- Returns:
- An Enumeration containing TreePath objects
public TreeModel getModel()
Returns the model of thisJTreeobject.
- Returns:
- the associated
TreeModel
public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias)
Returns the next table element (beginning from the rowstartingRowthat starts withprefix. Searching is done in the direction specified bybias.
- Parameters:
prefix- the prefix to search for in the cell valuesstartingRow- the index of the row where to start searching frombias- the search direction, eitherPosition.Bias.ForwardorPosition.Bias.Backward
- Returns:
- the path to the found element or -1 if no such element has been found
- Throws:
IllegalArgumentException- if prefix isnullor startingRow is not valid
- Since:
- 1.4
public Dimension getPreferredScrollableViewportSize()
Returns the preferred viewport size.
- Specified by:
- getPreferredScrollableViewportSize in interface Scrollable
- Returns:
- the preferred size
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
- Specified by:
- getScrollableBlockIncrement in interface Scrollable
public boolean getScrollableTracksViewportHeight()
- Specified by:
- getScrollableTracksViewportHeight in interface Scrollable
public boolean getScrollableTracksViewportWidth()
- Specified by:
- getScrollableTracksViewportWidth in interface Scrollable
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
- Specified by:
- getScrollableUnitIncrement in interface Scrollable
public TreeExpansionListener[] getTreeExpansionListeners()
Returns all addedTreeExpansionListenerobjects.
- Returns:
- an array of listeners
public TreeSelectionListener[] getTreeSelectionListeners()
Returns all addedTreeSelectionListenerobjects.
- Returns:
- an array of listeners
public TreeWillExpandListener[] getTreeWillExpandListeners()
Returns all addedTreeWillExpandListenerobjects.
- Returns:
- an array of listeners
public TreeUI getUI()
Return the UI associated with thisJTreeobject.
- Returns:
- the associated
TreeUIobject
public String getUIClassID()
This method returns the String ID of the UI class of Separator.
- Overrides:
- getUIClassID in interface JComponent
- Returns:
- The UI class' String ID.
public boolean isEditable()
Checks if thisJTreeobject is editable.
- Returns:
trueif this tree object is editable,falseotherwise
public boolean isRootVisible()
Checks if the root element is visible.
- Returns:
trueif the root element is visible,falseotherwise
public String paramString()
A String representation of this JTree. This is intended to be used for debugging. The returned string may be empty but may not benull.
- Overrides:
- paramString in interface JComponent
- Returns:
- a String representation of this JTree
protected boolean removeDescendantSelectedPaths(TreePath path, boolean includeSelected)
Removes any paths in the current set of selected paths that are descendants ofpath. IfincludePathis set totrueandpathitself is selected, then it will be removed too.
- Parameters:
path- the path from which selected descendants are to be removedincludeSelected- iftruethenpathitself will also be remove if it's selected
- Returns:
trueif something has been removed,falseotherwise
- Since:
- 1.3
protected void removeDescendantToggledPaths(Enumeration toRemove)
Removes any descendants of the TreePaths in toRemove that have been expanded.
- Parameters:
toRemove- - Enumeration of TreePaths that need to be removed from cache of toggled tree paths.
public void removeTreeExpansionListener(TreeExpansionListener listener)
Removes aTreeExpansionListenerobject from the tree.
- Parameters:
listener- the listener to remove
public void removeTreeSelectionListener(TreeSelectionListener listener)
Removes aTreeSelectionListenerobject from the tree.
- Parameters:
listener- the listener to remove
public void removeTreeWillExpandListener(TreeWillExpandListener listener)
Removes aTreeWillExpandListenerobject from the tree.
- Parameters:
listener- the listener to remove
public void setDragEnabled(boolean enabled)
Set thedragEnabledproperty.
- Parameters:
enabled- new value
- Since:
- 1.4
public void setEditable(boolean flag)
Sets theeditableproperty.
- Parameters:
flag-trueto make this tree object editable,falseotherwise
public void setModel(TreeModel model)
Sets the model to use inJTree.
- Parameters:
model- theTreeModelto use
public void setUI(TreeUI ui)
Sets the UI associated with thisJTreeobject.
- Parameters:
ui- theTreeUIto associate
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). You should never have to invoke this, the UI will invoke this as it needs to.
public void updateUI()
This method resets the UI used to the Look and Feel defaults..
- Overrides:
- updateUI in interface JComponent