/Users/lyon/j4p/src/j3d/viewer/SceneTreePanel.java

1    package j3d.viewer; 
2     
3    /* 
4     * 
5     * (c) September 1998 by Mauro Marinilli 
6     * 
7     */ 
8     
9     
10   import javax.swing.*; 
11   import java.awt.*; 
12    
13    
14   public class SceneTreePanel extends JPanel { 
15       private JTree tree; 
16    
17   //  public SceneTreePanel( BranchGroup g ) { 
18   //    this( new SceneTreeModel( g ) ); 
19   //  } 
20    
21       public SceneTreePanel(j3d.viewer.SceneTreeModel model) { 
22           tree = new JTree(model) { 
23               public String convertValueToText(Object value, boolean selected, 
24                                                boolean expanded, boolean leaf, int row, 
25                                                boolean hasFocus) { 
26                   return value.toString(); 
27               } 
28           }; 
29    
30           tree.setRootVisible(false); 
31           tree.setShowsRootHandles(true); 
32           tree.putClientProperty("JTree.lineStyle", "Angled"); 
33    
34           setLayout(new BorderLayout()); 
35           add(tree, BorderLayout.CENTER); 
36       } 
37    
38       public JTree getTree() { 
39           return tree; 
40       } 
41   } 
42    
43    
44