1
4
5 import org.aswing.*;
6 import org.aswing.geom.*;
7 import org.aswing.graphices.*;
8 import org.aswing.border.*;
9
10
13 class org.aswing.border.LineBorder extends DecorateBorder{
14
15 private var color:ASColor;
16 private var thickness:Number;
17 private var round:Number;
18
19
30 public function LineBorder(interior:Border, color:ASColor, thickness:Number, round:Number){
31 super(interior);
32 this.color = (color == undefined ? ASColor.BLACK : color);
33 this.thickness = (thickness == undefined ? 1 : thickness);
34 this.round = (round == undefined ? 0 : round);
35 this.round = Math.max(0, this.round);
36 }
37
38 public function paintBorderImp(c:Component, g:Graphics, b:Rectangle):Void{
39 var t:Number = thickness;
40 if(round <= 0){
41 g.drawRectangle(new Pen(color, thickness), b.x + t/2, b.y + t/2, b.width - t, b.height - t);
42 }else{
43 g.fillRoundRectRingWithThickness(new SolidBrush(color), b.x, b.y, b.width, b.height, round, t);
44 }
45 }
46
47 public function getBorderInsetsImp(c:Component, bounds:Rectangle):Insets{
48 var width:Number = Math.ceil(thickness + round - round*0.707106781186547);
49 return new Insets(width, width, width, width);
50 }
51
52 public function getColor():ASColor {
53 return color;
54 }
55
56 public function setColor(color:ASColor):Void {
57 this.color = color;
58 }
59
60 public function getThickness():Number {
61 return thickness;
62 }
63
64 public function setThickness(thickness:Number):Void {
65 this.thickness = thickness;
66 }
67
68 public function getRound():Number {
69 return round;
70 }
71
72 public function setRound(round:Number):Void {
73 this.round = round;
74 }
75 }
76