View Javadoc

1   package org.catacomb.druid.gui.base;
2   
3   import org.catacomb.druid.swing.DBoxPanel;
4   import org.catacomb.interlish.interact.DComponent;
5   
6   
7   public class DruBoxPanel extends DruSubcontainerPanel {
8   
9       static final long serialVersionUID = 1001;
10  
11      public final static int VERTICAL = 1;
12      public final static int HORIZONTAL = 2;
13  
14      boolean first = true;
15      int spacing;
16      int idir;
17  
18  
19      DBoxPanel dBoxPanel;
20  
21  
22      public DruBoxPanel() {
23          this(VERTICAL);
24      }
25  
26  
27      public DruBoxPanel(int dir) {
28          this(dir, 2);
29      }
30  
31  
32      public DruBoxPanel(int dir, int pspace) {
33          super();
34  
35          if (dir == VERTICAL) {
36              dBoxPanel = new DBoxPanel(DBoxPanel.VERTICAL);
37          } else {
38              dBoxPanel = new DBoxPanel(DBoxPanel.HORIZONTAL);
39          }
40          spacing = pspace;
41  
42          setSingle();
43          getGUIPeer().addDComponent(dBoxPanel);
44      }
45  
46  
47  
48      public void addGlue() {
49          dBoxPanel.addGlue();
50      }
51  
52  
53      public void subAddPanel(DruPanel dp) {
54          subAddDComponent(dp.getGUIPeer());
55      }
56  
57      public void subAddDComponent(DComponent obj) {
58          dBoxPanel.addDComponent(obj);
59  
60          if (first) {
61              first = false;
62          } else {
63              if (spacing > 0) {
64                  if (idir == VERTICAL) {
65                      dBoxPanel.addVerticalStrut(spacing);
66                  } else {
67                      dBoxPanel.addHorizontalStrut(spacing);
68                  }
69              }
70          }
71      }
72  
73  
74      public void subRemoveAll() {
75          dBoxPanel.removeAll();
76      }
77  
78  
79  }