java.lang.Object
javax.swing.tree.DefaultTreeModel
- All Implemented Interfaces:
- Serializable, TreeModel
- See Also:
- Top Examples, Source Code,
XMLEncoder
public void addTreeModelListener(TreeModelListener l)
- See Also:
removeTreeModelListener(javax.swing.event.TreeModelListener)
, TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected boolean asksAllowsChildren
- See Also:
setAsksAllowsChildren(boolean)
, TreeModel.isLeaf(java.lang.Object)
, TreeNode.getAllowsChildren()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean asksAllowsChildren()
- See Also:
asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public DefaultTreeModel(TreeNode root)
- See Also:
DefaultTreeModel(TreeNode, boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public DefaultTreeModel(TreeNode root,
boolean asksAllowsChildren)
- See Also:
asksAllowsChildren
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireTreeNodesChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireTreeNodesInserted(Object source,
Object[] path,
int[] childIndices,
Object[] children)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireTreeNodesRemoved(Object source,
Object[] path,
int[] childIndices,
Object[] children)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void fireTreeStructureChanged(Object source,
Object[] path,
int[] childIndices,
Object[] children)
- See Also:
EventListenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object getChild(Object parent,
int index)
- See Also:
- TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getChildCount(Object parent)
- See Also:
- TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getIndexOfChild(Object parent,
Object child)
- See Also:
- TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[696]Creating subtree of node
By Anonymous on 2004/03/11 13:56:11 Rate
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
public class tre
{
public static void main ( String arv [ ] )
{
DefaultMutableTreeNode top=new DefaultMutableTreeNode ( "Directories" ) ;
//creating subtree of node
DefaultMutableTreeNode a=new DefaultMutableTreeNode ( "File1" ) ;
top.add ( a ) ;
DefaultMutableTreeNode b=new DefaultMutableTreeNode ( "File2" ) ;
top.add ( b ) ;
DefaultMutableTreeNode a1=new DefaultMutableTreeNode ( "Options a1" ) ;
DefaultMutableTreeNode a2=new DefaultMutableTreeNode ( "Options a2" ) ;
DefaultMutableTreeNode b1=new DefaultMutableTreeNode ( "Options b1" ) ;
DefaultMutableTreeNode b2=new DefaultMutableTreeNode ( "Options b2" ) ;
a.add ( a1 ) ;
a.add ( a2 ) ;
b.add ( b1 ) ;
b.add ( b2 ) ;
top.getIndexOfChild ( a1,a ) ;
top.getIndexOfChild ( b1,b ) ;
}
}
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
- See Also:
getTreeModelListeners()
, ClassCastException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeNode[] getPathToRoot(TreeNode aNode)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected TreeNode[] getPathToRoot(TreeNode aNode,
int depth)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object getRoot()
- See Also:
- TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public TreeModelListener[] getTreeModelListeners()
- See Also:
removeTreeModelListener(javax.swing.event.TreeModelListener)
, addTreeModelListener(javax.swing.event.TreeModelListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent,
int index)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isLeaf(Object node)
- See Also:
asksAllowsChildren
, TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected EventListenerList listenerList
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void nodeChanged(TreeNode node)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void nodesChanged(TreeNode node,
int[] childIndices)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void nodeStructureChanged(TreeNode node)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void nodesWereInserted(TreeNode node,
int[] childIndices)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void nodesWereRemoved(TreeNode node,
int[] childIndices,
Object[] removedChildren)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void reload()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[327]Problem with DefaultTreeModel
By dharmendra { dot } gupta { at } hotmail { dot } com on 2003/07/23 04:37:24 Rate
DefaultTreeModel model = ( DefaultTreeModel ) treeSelectedPerson.getModel ( ) ;
model.reload ( ) ;
It throws null pointer exception
public void reload(TreeNode node)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeNodeFromParent(MutableTreeNode node)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeTreeModelListener(TreeModelListener l)
- See Also:
addTreeModelListener(javax.swing.event.TreeModelListener)
, TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected TreeNode root
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setAsksAllowsChildren(boolean newValue)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setRoot(TreeNode root)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void valueForPathChanged(TreePath path,
Object newValue)
- See Also:
- TreeModel
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples