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