JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / awt / font / GraphicAttribute.js
1 Clazz.declarePackage ("java.awt.font");\r
2 Clazz.load (null, "java.awt.font.GraphicAttribute", ["java.lang.IllegalArgumentException", "java.awt.geom.Rectangle2D"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.fAlignment = 0;\r
5 Clazz.instantialize (this, arguments);\r
6 }, java.awt.font, "GraphicAttribute");\r
7 Clazz.makeConstructor (c$, \r
8 function (alignment) {\r
9 if (alignment < -2 || alignment > 2) {\r
10 throw  new IllegalArgumentException ("bad alignment");\r
11 }this.fAlignment = alignment;\r
12 }, "~N");\r
13 Clazz.defineMethod (c$, "getBounds", \r
14 function () {\r
15 var ascent = this.getAscent ();\r
16 return  new java.awt.geom.Rectangle2D.Float (0, -ascent, this.getAdvance (), ascent + this.getDescent ());\r
17 });\r
18 Clazz.defineMethod (c$, "getAlignment", \r
19 function () {\r
20 return this.fAlignment;\r
21 });\r
22 Clazz.defineStatics (c$,\r
23 "TOP_ALIGNMENT", -1,\r
24 "BOTTOM_ALIGNMENT", -2,\r
25 "ROMAN_BASELINE", 0,\r
26 "CENTER_BASELINE", 1,\r
27 "HANGING_BASELINE", 2);\r
28 });\r