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.idltree; 26 27 import javax.swing.*; 28 import javax.swing.event.*; 29 import javax.swing.tree.*; 30 31 public class IdlModel extends DefaultTreeModel { 32 private TreePath selection; 33 private IdlNode nodeRoot; 34 35 public IdlModel() { 36 super(new DefaultMutableTreeNode()); 37 } 38 39 public IdlModel(IdlNode root) { 40 super(root); 41 nodeRoot = root; 42 selection = new TreePath(root); 43 } 44 45 public TreePath getSelection() { 46 return selection; 47 } 48 49 public void setSelection(TreePath s) { 50 selection = s; 51 } 52 53 public void setRoot(IdlNode root) { 54 super.setRoot(root); 55 nodeRoot = root; 56 selection = new TreePath(root); 57 } 58 } 59 | Popular Tags |