View Javadoc

1   package org.catacomb.druid.swing;
2   
3   import javax.swing.Box;
4   import javax.swing.BoxLayout;
5   
6   import javax.swing.JPanel;
7   
8   import javax.swing.JComponent;
9   
10  import org.catacomb.interlish.interact.DComponent;
11  
12  
13  public class DBoxPanel extends JPanel implements DComponent {
14      private static final long serialVersionUID = 1L;
15  
16      public final static int VERTICAL = 1;
17      public final static int HORIZONTAL = 2;
18  
19  
20      public DBoxPanel(int dir) {
21  
22          if (dir == VERTICAL) {
23              setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
24          } else {
25              setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
26          }
27      }
28  
29      public void setTooltip(String s) {
30          setToolTipText(s);
31      }
32  
33  
34      public void addGlue() {
35          add(Box.createGlue());
36      }
37  
38  
39      public void addVerticalStrut(int spacing) {
40          add(Box.createVerticalStrut(spacing));
41      }
42  
43      public void addHorizontalStrut(int spacing) {
44          add(Box.createHorizontalStrut(spacing));
45      }
46  
47  
48      public void addDComponent(DComponent obj) {
49          add((JComponent)obj);
50  
51      }
52  
53  
54  }