1
4
5 import org.aswing.BoxLayout;
6 import org.aswing.Component;
7 import org.aswing.Container;
8 import org.aswing.JPanel;
9
10
13 class org.aswing.Box extends JPanel{
14
15
24 public function Box(axis:Number, gap:Number){
25 super();
26 setName("Box");
27 setLayout(new BoxLayout(axis, gap));
28 }
29
30
35 public static function createHorizontalBox(gap:Number):Box{
36 return new Box(BoxLayout.X_AXIS, gap);
37 }
38
39
44 public static function createVerticalBox(gap:Number):Box{
45 return new Box(BoxLayout.Y_AXIS, gap);
46 }
47
48 public static function createHorizontalGlue():Component{
49 var glue:Container = new JPanel();
50 glue.setOpaque(false);
51 glue.setMinimumSize(0, 0);
52 glue.setPreferredSize(0, 0);
53 glue.setMaximumSize(0, Number.MAX_VALUE);
54 return glue;
55 }
56
57 public static function createVerticalGlue():Component{
58 var glue:Container = new JPanel();
59 glue.setOpaque(false);
60 glue.setMinimumSize(0, 0);
61 glue.setPreferredSize(0, 0);
62 glue.setMaximumSize(Number.MAX_VALUE, 0);
63 return glue;
64 }
65 }
66