blob: 3ee0f344cd81ded583192f5dc075ea797cba905a (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
package javax.swing;
import java.awt.*;
public class BoxLayout implements LayoutManager2
{
GridLayout gridbag;
final static int X_AXIS = 0;
final static int Y_AXIS = 1;
int way = X_AXIS;
BoxLayout(JComponent p,
int way)
{
int width = 0;
int height = 0;
this.way = way;
if (way == X_AXIS)
{
width = 1;
}
else
{
height = 1;
}
gridbag = new GridLayout(width, height);
}
BoxLayout(int way)
{
this(null,way);
}
public void addLayoutComponent(String name, Component comp)
{
if (way == X_AXIS)
{
gridbag.setColumns( gridbag.getColumns() + 1);
}
else
{
gridbag.setRows( gridbag.getRows() + 1);
}
}
public void removeLayoutComponent(Component comp)
{
gridbag.removeLayoutComponent(comp);
if (way == X_AXIS)
{
gridbag.setColumns( gridbag.getColumns() - 1);
}
else
{
gridbag.setRows( gridbag.getRows() - 1);
}
}
public Dimension preferredLayoutSize(Container parent)
{
return gridbag.preferredLayoutSize(parent);
}
public Dimension minimumLayoutSize(Container parent)
{
return gridbag.minimumLayoutSize(parent);
}
public void layoutContainer(Container parent)
{
gridbag.layoutContainer(parent);
}
public void addLayoutComponent ( Component child, Object constraints )
{
addLayoutComponent("", child);
}
public float getLayoutAlignmentX ( Container parent )
{
return 0;
}
public float getLayoutAlignmentY ( Container parent )
{
return 0;
}
public void invalidateLayout ( Container parent )
{
}
public Dimension maximumLayoutSize ( Container parent )
{
return preferredLayoutSize(parent);
}
}
|