Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3658 schaersvoo 1
/*
2
 * Created on 01.10.2004
3
 *
4
 */
5
package rene.gui;
6
 
7
import java.awt.*;
8
 
9
/**
10
 * @author Rene
11
 * A panel for two components. The left one uses its width.
12
 *
13
 */
14
public class IconBarPanel
15
        extends MyPanel
16
{       Component C1,C2;
17
        int IX=0,IY=0;
18
 
19
        public IconBarPanel (Component c1, Component c2)
20
        {       C1=c1; C2=c2;
21
                add(C1);
22
                add(C2);
23
        }
24
 
25
        public void doLayout ()
26
        {       int w=C1.getPreferredSize().width;
27
                C1.setSize(w,getSize().height-2*IY);
28
                C1.setLocation(IX,IY);
29
                C2.setSize(getSize().width-3*IX-w,getSize().height-2*IX);
30
                C2.setLocation(w+2*IX,IY);
31
                C1.doLayout();
32
                C2.doLayout();
33
        }
34
 
35
        public Dimension getPreferredSize ()
36
        {       Dimension d1=C1.getPreferredSize(),d2=C2.getPreferredSize();
37
                return new Dimension(d1.width+d2.width,
38
                        Math.max(d1.height,d2.height));
39
        }
40
 
41
        public void setInsets (int x, int y)
42
        {       IX=x; IY=y;
43
        }
44
 
45
        public static void main(String[] args)
46
        {}
47
}