FileDocCategorySizeDatePackage
GenealogyTree.javaAPI DocExample1005Tue Dec 12 18:59:20 GMT 2000None

GenealogyTree

public class GenealogyTree extends JTree

Fields Summary
GenealogyModel
model
Constructors Summary
public GenealogyTree(Person graphNode)

        super(new GenealogyModel(graphNode));
        getSelectionModel().setSelectionMode(
                TreeSelectionModel.SINGLE_TREE_SELECTION);
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        Icon personIcon = null;
        renderer.setLeafIcon(personIcon);
        renderer.setClosedIcon(personIcon);
        renderer.setOpenIcon(personIcon);
        setCellRenderer(renderer);
    
Methods Summary
public voidshowAncestor(boolean b)
Get the selected item in the tree, and call showAncestor with this item on the model.

        Object newRoot = null;
        TreePath path = getSelectionModel().getSelectionPath();
        if (path != null) {
            newRoot = path.getLastPathComponent();
        }
        ((GenealogyModel)getModel()).showAncestor(b, newRoot);