Returns a TreeModel wrapping the specified object. If the object is: an array of Object s, a Hashtable , or a Vector then a new root node is created with each of the incoming objects as children. Otherwise, a new root is created
(Object value)
| 542 | * @return a <code>TreeModel</code> wrapping the specified object |
| 543 | */ |
| 544 | protected static TreeModel createTreeModel(Object value) { |
| 545 | DefaultMutableTreeNode root; |
| 546 | |
| 547 | if((value instanceof Object[]) || (value instanceof Hashtable) || |
| 548 | (value instanceof Vector)) { |
| 549 | root = new DefaultMutableTreeNode("root"); |
| 550 | DynamicUtilTreeNode.createChildren(root, value); |
| 551 | } |
| 552 | else { |
| 553 | root = new DynamicUtilTreeNode("root", value); |
| 554 | } |
| 555 | return new DefaultTreeModel(root, false); |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Returns a <code>JTree</code> with a sample model. |