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