package animation; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; public class PseudoCodeNode extends DefaultMutableTreeNode { /** * */ private static final long serialVersionUID = 1L; private boolean selected; private JTree tree; public PseudoCodeNode( String description, JTree tree ) { super( description ); selected = false; this.tree = tree; } public boolean isSelected() { return selected; } public void setSelected( boolean selected ) { if( selected ) tree.expandPath( new TreePath( this.getPath() ) ); else tree.collapsePath( new TreePath( this.getPath() ) ); this.selected = selected; } }