acaefa7c114b1bb0620dec81437892f20f284bac
[jalviewjs.git] / site / j2s / javax / swing / border / EtchedBorder.js
1 Clazz.declarePackage ("javax.swing.border");\r
2 Clazz.load (["javax.swing.border.AbstractBorder"], "javax.swing.border.EtchedBorder", ["java.awt.Insets"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.etchType = 0;\r
5 this.highlight = null;\r
6 this.shadow = null;\r
7 Clazz.instantialize (this, arguments);\r
8 }, javax.swing.border, "EtchedBorder", javax.swing.border.AbstractBorder);\r
9 Clazz.makeConstructor (c$, \r
10 function () {\r
11 this.construct (1);\r
12 });\r
13 Clazz.makeConstructor (c$, \r
14 function (etchType) {\r
15 this.construct (etchType, null, null);\r
16 }, "~N");\r
17 Clazz.makeConstructor (c$, \r
18 function (highlight, shadow) {\r
19 this.construct (1, highlight, shadow);\r
20 }, "java.awt.Color,java.awt.Color");\r
21 Clazz.makeConstructor (c$, \r
22 function (etchType, highlight, shadow) {\r
23 Clazz.superConstructor (this, javax.swing.border.EtchedBorder, []);\r
24 this.etchType = etchType;\r
25 this.highlight = highlight;\r
26 this.shadow = shadow;\r
27 }, "~N,java.awt.Color,java.awt.Color");\r
28 Clazz.overrideMethod (c$, "paintBorder", \r
29 function (c, g, x, y, width, height) {\r
30 var w = width;\r
31 var h = height;\r
32 g.translate (x, y);\r
33 g.setColor (this.etchType == 1 ? this.getShadowColor (c) : this.getHighlightColor (c));\r
34 g.drawRect (0, 0, w - 2, h - 2);\r
35 g.setColor (this.etchType == 1 ? this.getHighlightColor (c) : this.getShadowColor (c));\r
36 g.drawLine (1, h - 3, 1, 1);\r
37 g.drawLine (1, 1, w - 3, 1);\r
38 g.drawLine (0, h - 1, w - 1, h - 1);\r
39 g.drawLine (w - 1, h - 1, w - 1, 0);\r
40 g.translate (-x, -y);\r
41 }, "java.awt.Component,java.awt.Graphics,~N,~N,~N,~N");\r
42 Clazz.defineMethod (c$, "getBorderInsets", \r
43 function (c) {\r
44 return  new java.awt.Insets (2, 2, 2, 2);\r
45 }, "java.awt.Component");\r
46 Clazz.defineMethod (c$, "getBorderInsets", \r
47 function (c, insets) {\r
48 insets.left = insets.top = insets.right = insets.bottom = 2;\r
49 return insets;\r
50 }, "java.awt.Component,java.awt.Insets");\r
51 Clazz.overrideMethod (c$, "isBorderOpaque", \r
52 function () {\r
53 return true;\r
54 });\r
55 Clazz.defineMethod (c$, "getEtchType", \r
56 function () {\r
57 return this.etchType;\r
58 });\r
59 Clazz.defineMethod (c$, "getHighlightColor", \r
60 function (c) {\r
61 return this.highlight != null ? this.highlight : c.getBackground ().brighter ();\r
62 }, "java.awt.Component");\r
63 Clazz.defineMethod (c$, "getHighlightColor", \r
64 function () {\r
65 return this.highlight;\r
66 });\r
67 Clazz.defineMethod (c$, "getShadowColor", \r
68 function (c) {\r
69 return this.shadow != null ? this.shadow : c.getBackground ().darker ();\r
70 }, "java.awt.Component");\r
71 Clazz.defineMethod (c$, "getShadowColor", \r
72 function () {\r
73 return this.shadow;\r
74 });\r
75 Clazz.defineStatics (c$,\r
76 "RAISED", 0,\r
77 "LOWERED", 1);\r
78 });\r