1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 package org.coach.actor.componentBrowser; 26 27 import javax.swing.*; 28 import javax.swing.event.*; 29 import javax.swing.tree.*; 30 31 public class ComponentModel extends DefaultTreeModel { 32 private TreePath selection; 33 private ComponentNode nodeRoot; 34 35 public ComponentModel(ComponentNode root) { 36 super(root); 37 nodeRoot = root; 38 refresh(); 39 } 40 41 public TreePath getSelection() { 42 return selection; 43 } 44 45 public void setSelection(TreePath s) { 46 selection = s; 47 } 48 49 public void refresh() { 50 ComponentNode newRoot = (ComponentNode)nodeRoot.clone(); 51 newRoot.explore(); 52 setRoot(newRoot); 53 } 54 } | Popular Tags |