1 Clazz.declarePackage ("javax.swing.border");
\r
2 Clazz.load (["javax.swing.border.AbstractBorder"], "javax.swing.border.LineBorder", ["java.awt.Color", "$.Graphics2D", "$.Insets", "java.awt.geom.Path2D", "$.Rectangle2D", "$.RoundRectangle2D"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
5 this.lineColor = null;
\r
6 this.roundedCorners = false;
\r
7 Clazz.instantialize (this, arguments);
\r
8 }, javax.swing.border, "LineBorder", javax.swing.border.AbstractBorder);
\r
9 c$.createBlackLineBorder = Clazz.defineMethod (c$, "createBlackLineBorder",
\r
11 if (javax.swing.border.LineBorder.blackLine == null) {
\r
12 javax.swing.border.LineBorder.blackLine = new javax.swing.border.LineBorder (java.awt.Color.black, 1);
\r
13 }return javax.swing.border.LineBorder.blackLine;
\r
15 c$.createGrayLineBorder = Clazz.defineMethod (c$, "createGrayLineBorder",
\r
17 if (javax.swing.border.LineBorder.grayLine == null) {
\r
18 javax.swing.border.LineBorder.grayLine = new javax.swing.border.LineBorder (java.awt.Color.gray, 1);
\r
19 }return javax.swing.border.LineBorder.grayLine;
\r
21 Clazz.makeConstructor (c$,
\r
23 this.construct (color, 1, false);
\r
24 }, "java.awt.Color");
\r
25 Clazz.makeConstructor (c$,
\r
26 function (color, thickness) {
\r
27 this.construct (color, thickness, false);
\r
28 }, "java.awt.Color,~N");
\r
29 Clazz.makeConstructor (c$,
\r
30 function (color, thickness, roundedCorners) {
\r
31 Clazz.superConstructor (this, javax.swing.border.LineBorder, []);
\r
32 this.lineColor = color;
\r
33 this.thickness = thickness;
\r
34 this.roundedCorners = roundedCorners;
\r
35 }, "java.awt.Color,~N,~B");
\r
36 Clazz.overrideMethod (c$, "paintBorder",
\r
37 function (c, g, x, y, width, height) {
\r
38 if ((this.thickness > 0) && (Clazz.instanceOf (g, java.awt.Graphics2D))) {
\r
40 var oldColor = g2d.getColor ();
\r
41 g2d.setColor (this.lineColor);
\r
44 var offs = this.thickness;
\r
45 var size = offs + offs;
\r
46 if (this.roundedCorners) {
\r
47 var arc = offs + size;
\r
48 outer = new java.awt.geom.RoundRectangle2D.Float (x, y, width, height, arc, arc);
\r
49 inner = new java.awt.geom.RoundRectangle2D.Float (x + offs, y + offs, width - size, height - size, arc, arc);
\r
51 outer = new java.awt.geom.Rectangle2D.Float (x, y, width, height);
\r
52 inner = new java.awt.geom.Rectangle2D.Float (x + offs, y + offs, width - size, height - size);
\r
53 }var path = new java.awt.geom.Path2D.Float (0);
\r
54 path.append (outer, false);
\r
55 path.append (inner, false);
\r
57 g2d.setColor (oldColor);
\r
58 }}, "java.awt.Component,java.awt.Graphics,~N,~N,~N,~N");
\r
59 Clazz.defineMethod (c$, "getBorderInsets",
\r
61 return new java.awt.Insets (this.thickness, this.thickness, this.thickness, this.thickness);
\r
62 }, "java.awt.Component");
\r
63 Clazz.defineMethod (c$, "getBorderInsets",
\r
64 function (c, insets) {
\r
65 insets.left = insets.top = insets.right = insets.bottom = this.thickness;
\r
67 }, "java.awt.Component,java.awt.Insets");
\r
68 Clazz.defineMethod (c$, "getLineColor",
\r
70 return this.lineColor;
\r
72 Clazz.defineMethod (c$, "getThickness",
\r
74 return this.thickness;
\r
76 Clazz.defineMethod (c$, "getRoundedCorners",
\r
78 return this.roundedCorners;
\r
80 Clazz.overrideMethod (c$, "isBorderOpaque",
\r
82 return !this.roundedCorners;
\r
84 Clazz.defineStatics (c$,
\r