Normand Briere
2018-07-07 09ddd38fd4a8a7100c834a5e976f4796fae53541
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package timeflow.app.ui;
 
import javax.swing.*;
import java.awt.*;
 
public class ComponentCluster extends JPanel
{
   int numComps=0;
   int x1=80;
   int width=200;
   int compH=30;
   DottedLine line=new DottedLine();
   
   public ComponentCluster(String name)
   {
       setBackground(Color.white);
       setLayout(null);
       JLabel label=new JLabel(name);
       add(label);
       label.setBounds(3,3,50,30);
       add(line);
   }
   
   public void addContent(JComponent c)
   {
       add(c);
       c.setBorder(null);
       c.setBounds(x1,10+numComps*compH, c.getPreferredSize().width, c.getPreferredSize().height);
       numComps++;
       line.setBounds(x1-10,10,1,numComps*compH-5);
   }
   
   public Dimension getPreferredSize()
   {
       return new Dimension(width, 20+compH*numComps);
   }
}