java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible, Scrollable
- See Also:
- Top Examples, Source Code,
XMLEncoder
, KeyStroke
, Action
, ActionMap
, InputMap
, setCellEditor(javax.swing.tree.TreeCellEditor)
, TreeCellEditor
, setCellRenderer(javax.swing.tree.TreeCellRenderer)
, TreeCellRenderer
public void addSelectionInterval(int index0,
int index1)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addSelectionPath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addSelectionPaths(TreePath[] paths)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addSelectionRow(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addSelectionRows(int[] rows)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addTreeExpansionListener(TreeExpansionListener tel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addTreeSelectionListener(TreeSelectionListener tsl)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addTreeWillExpandListener(TreeWillExpandListener tel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ANCHOR_SELECTION_PATH_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void cancelEditing()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient TreeCellEditor cellEditor
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient TreeCellRenderer cellRenderer
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String CELL_EDITOR_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String CELL_RENDERER_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void clearSelection()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void clearToggledPaths()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void collapsePath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void collapseRow(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String convertValueToText(Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected static TreeModel createTreeModel(Object value)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected TreeModelListener createTreeModelListener()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean editable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String EDITABLE_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void expandPath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void expandRow(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String EXPANDS_SELECTED_PATHS_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void fireTreeCollapsed(TreePath path)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void fireTreeExpanded(TreePath path)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void fireTreeWillCollapse(TreePath path)
throws ExpandVetoException
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void fireTreeWillExpand(TreePath path)
throws ExpandVetoException
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireValueChanged(TreeSelectionEvent e)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public AccessibleContext getAccessibleContext()
- See Also:
- JComponent, Accessible
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getAnchorSelectionPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeCellEditor getCellEditor()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeCellRenderer getCellRenderer()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getClosestPathForLocation(int x,
int y)
- See Also:
getPathBounds(javax.swing.tree.TreePath)
, getPathForLocation(int, int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getClosestRowForLocation(int x,
int y)
- See Also:
getRowBounds(int)
, getRowForLocation(int, int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected static TreeModel getDefaultTreeModel()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected Enumeration<TreePath> getDescendantToggledPaths(TreePath parent)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getDragEnabled()
- See Also:
setDragEnabled(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getEditingPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Enumeration<TreePath> getExpandedDescendants(TreePath parent)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getExpandsSelectedPaths()
- See Also:
setExpandsSelectedPaths(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getInvokesStopCellEditing()
- See Also:
setInvokesStopCellEditing(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object getLastSelectedPathComponent()
- See Also:
TreePath.getLastPathComponent()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getLeadSelectionPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getLeadSelectionRow()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getMaxSelectionRow()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getMinSelectionRow()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeModel getModel()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getNextMatch(String prefix,
int startingRow,
Position.Bias bias)
- See Also:
- IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected TreePath[] getPathBetweenRows(int index0,
int index1)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Rectangle getPathBounds(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getPathForLocation(int x,
int y)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getPathForRow(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Dimension getPreferredScrollableViewportSize()
- See Also:
JComponent.getPreferredSize()
, Scrollable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Rectangle getRowBounds(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getRowCount()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getRowForLocation(int x,
int y)
- See Also:
getClosestRowForLocation(int, int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getRowForPath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getRowHeight()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
- See Also:
JScrollBar.setBlockIncrement(int)
, Scrollable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getScrollableTracksViewportHeight()
- See Also:
- Scrollable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getScrollableTracksViewportWidth()
- See Also:
- Scrollable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
- See Also:
JScrollBar.setUnitIncrement(int)
, Scrollable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getScrollsOnExpand()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getSelectionCount()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeSelectionModel getSelectionModel()
- See Also:
setSelectionModel(javax.swing.tree.TreeSelectionModel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath getSelectionPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreePath[] getSelectionPaths()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int[] getSelectionRows()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean getShowsRootHandles()
- See Also:
showsRootHandles
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getToggleClickCount()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getToolTipText(MouseEvent event)
- See Also:
- JComponent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeExpansionListener[] getTreeExpansionListeners()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeSelectionListener[] getTreeSelectionListeners()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeWillExpandListener[] getTreeWillExpandListeners()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeUI getUI()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getUIClassID()
- See Also:
UIDefaults.getUI(javax.swing.JComponent)
, JComponent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getVisibleRowCount()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean hasBeenExpanded(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean invokesStopCellEditing
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String INVOKES_STOP_CELL_EDITING_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isCollapsed(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isCollapsed(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isEditable()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isEditing()
- See Also:
getSelectionPath()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isExpanded(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isExpanded(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isFixedRowHeight()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isLargeModel()
- See Also:
largeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isPathEditable(TreePath path)
- See Also:
isEditable()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isPathSelected(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isRootVisible()
- See Also:
rootVisible
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isRowSelected(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isSelectionEmpty()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isVisible(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public JTree()
- See Also:
DefaultTreeModel.asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1289]Create a tree
By Anonymous on 2005/05/05 10:57:32 Rate
import javax.swing.*;
import javax.swing.tree.*;
public class boom extends JApplet {
private JTree binboom;
private DefaultTreeModel treeModel;
public void init ( ) {
DefaultMutableTreeNode wortel, kind1, kind2, kleinkind1, kleinkind2;
wortel = new DefaultMutableTreeNode ( "root" ) ;
kind1 = new DefaultMutableTreeNode ( "levelA" ) ;
kind2 = new DefaultMutableTreeNode ( "levelB" ) ;
kleinkind1 = new DefaultMutableTreeNode ( "level1A" ) ;
kleinkind2 = new DefaultMutableTreeNode ( "level1B" ) ;
wortel.add ( kind1 ) ;
wortel.add ( kind2 ) ;
kind1.add ( kleinkind1 ) ;
kind1.add ( kleinkind2 ) ;
treeModel = new DefaultTreeModel ( wortel ) ;
binboom = new JTree ( treeModel ) ;
getContentPane ( ) .add ( binboom ) ;
}
}
public JTree(Object[] value)
- See Also:
DefaultTreeModel.asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public JTree(Hashtable<?,?> value)
- See Also:
DefaultTreeModel.asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public JTree(Vector<?> value)
- See Also:
DefaultTreeModel.asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public JTree(TreeModel newModel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public JTree(TreeNode root)
- See Also:
DefaultTreeModel.asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public JTree(TreeNode root,
boolean asksAllowsChildren)
- See Also:
DefaultTreeModel.asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean largeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String LARGE_MODEL_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String LEAD_SELECTION_PATH_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void makeVisible(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected String paramString()
- See Also:
- JComponent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean removeDescendantSelectedPaths(TreePath path,
boolean includePath)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void removeDescendantToggledPaths(Enumeration<TreePath> toRemove)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeSelectionInterval(int index0,
int index1)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeSelectionPath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeSelectionPaths(TreePath[] paths)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeSelectionRow(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeSelectionRows(int[] rows)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeTreeExpansionListener(TreeExpansionListener tel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeTreeSelectionListener(TreeSelectionListener tsl)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeTreeWillExpandListener(TreeWillExpandListener tel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean rootVisible
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ROOT_VISIBLE_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected int rowHeight
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String ROW_HEIGHT_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void scrollPathToVisible(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void scrollRowToVisible(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean scrollsOnExpand
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String SCROLLS_ON_EXPAND_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient TreeSelectionModel selectionModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient JTree.TreeSelectionRedirector selectionRedirector
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String SELECTION_MODEL_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setAnchorSelectionPath(TreePath newPath)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setCellEditor(TreeCellEditor cellEditor)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setCellRenderer(TreeCellRenderer x)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setDragEnabled(boolean b)
- See Also:
TransferHandler
, JComponent.setTransferHandler(javax.swing.TransferHandler)
, getDragEnabled()
, GraphicsEnvironment.isHeadless()
, HeadlessException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setEditable(boolean flag)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void setExpandedState(TreePath path,
boolean state)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setExpandsSelectedPaths(boolean newValue)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setInvokesStopCellEditing(boolean newValue)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setLargeModel(boolean newValue)
- See Also:
largeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setLeadSelectionPath(TreePath newPath)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setModel(TreeModel newModel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setRootVisible(boolean rootVisible)
- See Also:
rootVisible
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setRowHeight(int rowHeight)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setScrollsOnExpand(boolean newValue)
- See Also:
getScrollsOnExpand()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectionInterval(int index0,
int index1)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectionModel(TreeSelectionModel selectionModel)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectionPath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectionPaths(TreePath[] paths)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectionRow(int row)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setSelectionRows(int[] rows)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setShowsRootHandles(boolean newValue)
- See Also:
getShowsRootHandles()
, showsRootHandles
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setToggleClickCount(int clickCount)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setUI(TreeUI ui)
- See Also:
UIDefaults.getUI(javax.swing.JComponent)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setVisibleRowCount(int newCount)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean showsRootHandles
- See Also:
rootVisible
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String SHOWS_ROOT_HANDLES_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void startEditingAtPath(TreePath path)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean stopEditing()
- See Also:
setInvokesStopCellEditing(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected int toggleClickCount
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String TOGGLE_CLICK_COUNT_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void treeDidChange()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient TreeModel treeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected transient TreeModelListener treeModelListener
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String TREE_MODEL_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void updateUI()
- See Also:
- JComponent
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected int visibleRowCount
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public static final String VISIBLE_ROW_COUNT_PROPERTY
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples