22c0219479fc6ac173ab5a59e08bf9dc2995dde8
[jalviewjs.git] / site / j2s / javax / swing / border / SoftBevelBorder.js
1 Clazz.declarePackage ("javax.swing.border");
2 Clazz.load (["javax.swing.border.BevelBorder"], "javax.swing.border.SoftBevelBorder", ["java.awt.Insets"], function () {
3 c$ = Clazz.declareType (javax.swing.border, "SoftBevelBorder", javax.swing.border.BevelBorder);
4 Clazz.overrideMethod (c$, "paintBorder", 
5 function (c, g, x, y, width, height) {
6 var oldColor = g.getColor ();
7 g.translate (x, y);
8 if (this.bevelType == 0) {
9 g.setColor (this.getHighlightOuterColor (c));
10 g.drawLine (0, 0, width - 2, 0);
11 g.drawLine (0, 0, 0, height - 2);
12 g.drawLine (1, 1, 1, 1);
13 g.setColor (this.getHighlightInnerColor (c));
14 g.drawLine (2, 1, width - 2, 1);
15 g.drawLine (1, 2, 1, height - 2);
16 g.drawLine (2, 2, 2, 2);
17 g.drawLine (0, height - 1, 0, height - 2);
18 g.drawLine (width - 1, 0, width - 1, 0);
19 g.setColor (this.getShadowOuterColor (c));
20 g.drawLine (2, height - 1, width - 1, height - 1);
21 g.drawLine (width - 1, 2, width - 1, height - 1);
22 g.setColor (this.getShadowInnerColor (c));
23 g.drawLine (width - 2, height - 2, width - 2, height - 2);
24 } else if (this.bevelType == 1) {
25 g.setColor (this.getShadowOuterColor (c));
26 g.drawLine (0, 0, width - 2, 0);
27 g.drawLine (0, 0, 0, height - 2);
28 g.drawLine (1, 1, 1, 1);
29 g.setColor (this.getShadowInnerColor (c));
30 g.drawLine (2, 1, width - 2, 1);
31 g.drawLine (1, 2, 1, height - 2);
32 g.drawLine (2, 2, 2, 2);
33 g.drawLine (0, height - 1, 0, height - 2);
34 g.drawLine (width - 1, 0, width - 1, 0);
35 g.setColor (this.getHighlightOuterColor (c));
36 g.drawLine (2, height - 1, width - 1, height - 1);
37 g.drawLine (width - 1, 2, width - 1, height - 1);
38 g.setColor (this.getHighlightInnerColor (c));
39 g.drawLine (width - 2, height - 2, width - 2, height - 2);
40 }g.translate (-x, -y);
41 g.setColor (oldColor);
42 }, "java.awt.Component,java.awt.Graphics,~N,~N,~N,~N");
43 Clazz.defineMethod (c$, "getBorderInsets", 
44 function (c) {
45 return this.getBorderInsets (c,  new java.awt.Insets (0, 0, 0, 0));
46 }, "java.awt.Component");
47 Clazz.defineMethod (c$, "getBorderInsets", 
48 function (c, insets) {
49 insets.top = insets.left = insets.bottom = insets.right = 3;
50 return insets;
51 }, "java.awt.Component,java.awt.Insets");
52 Clazz.overrideMethod (c$, "isBorderOpaque", 
53 function () {
54 return false;
55 });
56 });