JAL-1807 Bob
[jalviewjs.git] / site / j2s / swingjs / JSGraphicsEnvironment.js
1 Clazz.declarePackage ("swingjs");
2 Clazz.load (["java.awt.GraphicsEnvironment"], "swingjs.JSGraphicsEnvironment", ["swingjs.JSGraphics2D", "$.JSToolkit", "swingjs.api.DOMNode"], function () {
3 c$ = Clazz.declareType (swingjs, "JSGraphicsEnvironment", java.awt.GraphicsEnvironment);
4 Clazz.makeConstructor (c$, 
5 function () {
6 Clazz.superConstructor (this, swingjs.JSGraphicsEnvironment, []);
7 System.out.println ("JSGraphicsEnvironment initialized");
8 });
9 Clazz.overrideMethod (c$, "createGraphics", 
10 function (img) {
11 return this.createGraphicsSized (img, img.getWidth (), img.getHeight ());
12 }, "java.awt.image.BufferedImage");
13 Clazz.defineMethod (c$, "createGraphicsSized", 
14 function (img, width, height) {
15 var g = null;
16 {
17 g = img._g;
18 }if (g == null) {
19 var canvas = swingjs.api.DOMNode.createElement ("canvas", "img" + System.currentTimeMillis ());
20 {
21 canvas.width = width;
22 canvas.height = height;
23 img._canvas = canvas;
24 }g =  new swingjs.JSGraphics2D (canvas);
25 {
26 img._g = g;
27 }}return g;
28 }, "~O,~N,~N");
29 Clazz.overrideMethod (c$, "getAllFonts", 
30 function () {
31 return null;
32 });
33 Clazz.defineMethod (c$, "getAvailableFontFamilyNames", 
34 function () {
35 return null;
36 });
37 Clazz.defineMethod (c$, "getAvailableFontFamilyNames", 
38 function (l) {
39 return null;
40 }, "java.util.Locale");
41 Clazz.overrideMethod (c$, "getDefaultScreenDevice", 
42 function () {
43 if (swingjs.JSGraphicsEnvironment.device == null) swingjs.JSGraphicsEnvironment.device = swingjs.JSToolkit.getInstance ("swingjs.JSScreenDevice");
44 return swingjs.JSGraphicsEnvironment.device;
45 });
46 Clazz.defineStatics (c$,
47 "device", null);
48 });