View Javadoc

1   package net.wotonomy.test;
2   
3   import java.awt.BorderLayout;
4   import java.awt.Dimension;
5   
6   import javax.swing.JPanel;
7   import javax.swing.JScrollPane;
8   import javax.swing.JTree;
9   import javax.swing.border.EmptyBorder;
10  
11  /***
12  * A simple editor panel with a few textfields.
13  */
14  public class TreePanel extends JPanel 
15  {    
16  	public JTree tree;
17  	public EditPanel editPanel;
18      public JPanel panel;
19  	
20      public TreePanel()
21      {
22          panel = new JPanel();
23          panel.setLayout( new BorderLayout() );
24      	panel.setBorder( new EmptyBorder( 10, 10, 10, 10 ) );
25      
26  		tree = new JTree();
27  		tree.setRootVisible( false );
28  		tree.setShowsRootHandles( true );
29          JScrollPane scrollPane = new JScrollPane( tree );
30          scrollPane.setPreferredSize( new Dimension( 150, 200 ) );
31  		panel.add( scrollPane, BorderLayout.CENTER );
32  		editPanel = new EditPanel();
33  		panel.add( editPanel, BorderLayout.EAST );
34          
35          this.setLayout( new BorderLayout() );
36          this.add( panel, BorderLayout.CENTER );
37  	}
38      
39  }