Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / Graphics2D.js
1 Clazz.declarePackage ("java.awt");
2 Clazz.load (["java.awt.Graphics"], "java.awt.Graphics2D", null, function () {
3 c$ = Clazz.declareType (java.awt, "Graphics2D", java.awt.Graphics);
4 Clazz.makeConstructor (c$, 
5 function () {
6 Clazz.superConstructor (this, java.awt.Graphics2D, []);
7 });
8 Clazz.overrideMethod (c$, "draw3DRect", 
9 function (x, y, width, height, raised) {
10 var p = this.getPaint ();
11 var c = this.getColor ();
12 var brighter = c.brighter ();
13 var darker = c.darker ();
14 this.setColor (raised ? brighter : darker);
15 this.fillRect (x, y, 1, height + 1);
16 this.fillRect (x + 1, y, width - 1, 1);
17 this.setColor (raised ? darker : brighter);
18 this.fillRect (x + 1, y + height, width, 1);
19 this.fillRect (x + width, y, 1, height);
20 this.setPaint (p);
21 }, "~N,~N,~N,~N,~B");
22 Clazz.overrideMethod (c$, "fill3DRect", 
23 function (x, y, width, height, raised) {
24 var p = this.getPaint ();
25 var c = this.getColor ();
26 var brighter = c.brighter ();
27 var darker = c.darker ();
28 if (!raised) {
29 this.setColor (darker);
30 } else if (p !== c) {
31 this.setColor (c);
32 }this.fillRect (x + 1, y + 1, width - 2, height - 2);
33 this.setColor (raised ? brighter : darker);
34 this.fillRect (x, y, 1, height);
35 this.fillRect (x + 1, y, width - 2, 1);
36 this.setColor (raised ? darker : brighter);
37 this.fillRect (x + 1, y + height - 1, width - 1, 1);
38 this.fillRect (x + width - 1, y, 1, height - 1);
39 this.setPaint (p);
40 }, "~N,~N,~N,~N,~B");
41 });