JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / applet / Applet.js
1 Clazz.declarePackage ("java.applet");\r
2 Clazz.load (["java.awt.Panel"], "java.applet.Applet", ["java.net.URL", "java.util.Locale"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.stub = null;\r
5 Clazz.instantialize (this, arguments);\r
6 }, java.applet, "Applet", java.awt.Panel);\r
7 Clazz.makeConstructor (c$, \r
8 function () {\r
9 Clazz.superConstructor (this, java.applet.Applet, []);\r
10 this.setPanel ();\r
11 });\r
12 Clazz.defineMethod (c$, "setStub", \r
13 function (stub) {\r
14 this.stub = stub;\r
15 }, "java.applet.AppletStub");\r
16 Clazz.defineMethod (c$, "isActive", \r
17 function () {\r
18 if (this.stub != null) {\r
19 return this.stub.isActive ();\r
20 } else {\r
21 return false;\r
22 }});\r
23 Clazz.defineMethod (c$, "getDocumentBase", \r
24 function () {\r
25 return this.stub.getDocumentBase ();\r
26 });\r
27 Clazz.defineMethod (c$, "getCodeBase", \r
28 function () {\r
29 return this.stub.getCodeBase ();\r
30 });\r
31 Clazz.defineMethod (c$, "getParameter", \r
32 function (name) {\r
33 return this.stub.getParameter (name);\r
34 }, "~S");\r
35 Clazz.defineMethod (c$, "getAppletContext", \r
36 function () {\r
37 return this.stub.getAppletContext ();\r
38 });\r
39 Clazz.defineMethod (c$, "resize", \r
40 function (width, height) {\r
41 var d = this.size ();\r
42 if ((d.width != width) || (d.height != height)) {\r
43 Clazz.superCall (this, java.applet.Applet, "resize", [width, height]);\r
44 if (this.stub != null) {\r
45 this.stub.appletResize (width, height);\r
46 }}}, "~N,~N");\r
47 Clazz.defineMethod (c$, "resize", \r
48 function (d) {\r
49 this.resize (d.width, d.height);\r
50 }, "java.awt.Dimension");\r
51 Clazz.defineMethod (c$, "showStatus", \r
52 function (msg) {\r
53 this.getAppletContext ().showStatus (msg);\r
54 }, "~S");\r
55 Clazz.defineMethod (c$, "getImage", \r
56 function (url) {\r
57 return this.getAppletContext ().getImage (url);\r
58 }, "java.net.URL");\r
59 Clazz.defineMethod (c$, "getImage", \r
60 function (url, name) {\r
61 try {\r
62 return this.getImage ( new java.net.URL (url, name));\r
63 } catch (e) {\r
64 if (Clazz.exceptionOf (e, java.net.MalformedURLException)) {\r
65 return null;\r
66 } else {\r
67 throw e;\r
68 }\r
69 }\r
70 }, "java.net.URL,~S");\r
71 Clazz.defineMethod (c$, "getAppletInfo", \r
72 function () {\r
73 return null;\r
74 });\r
75 Clazz.defineMethod (c$, "getLocale", \r
76 function () {\r
77 var locale = Clazz.superCall (this, java.applet.Applet, "getLocale", []);\r
78 if (locale == null) {\r
79 return java.util.Locale.getDefault ();\r
80 }return locale;\r
81 });\r
82 Clazz.defineMethod (c$, "getParameterInfo", \r
83 function () {\r
84 return null;\r
85 });\r
86 Clazz.defineMethod (c$, "init", \r
87 function () {\r
88 });\r
89 Clazz.defineMethod (c$, "start", \r
90 function () {\r
91 });\r
92 Clazz.defineMethod (c$, "stop", \r
93 function () {\r
94 });\r
95 Clazz.defineMethod (c$, "destroy", \r
96 function () {\r
97 });\r
98 });\r