1
22
23 package com.liferay.lawt;
24
25 import java.applet.Applet;
26 import java.applet.AppletContext;
27 import java.applet.AppletStub;
28 import java.applet.AudioClip;
29
30 import java.awt.Frame;
31 import java.awt.Image;
32 import java.awt.event.WindowAdapter;
33 import java.awt.event.WindowEvent;
34
35 import java.io.InputStream;
36
37 import java.net.URL;
38
39 import java.util.Enumeration;
40 import java.util.HashMap;
41 import java.util.Iterator;
42 import java.util.Map;
43
44
50 public class AppletFrame extends Frame implements AppletStub, AppletContext {
51
52 public AppletFrame(Applet applet, int x, int y) {
53 this(applet, new HashMap(), x, y);
54 }
55
56 public AppletFrame(Applet applet, Map params, int x, int y) {
57 setTitle(applet.getClass().getName());
58 setSize(x, y);
59
60 _params = params;
61
62 addWindowListener(
63 new WindowAdapter() {
64 public void windowClosing(WindowEvent e) {
65 System.exit(0);
66 }
67 }
68 );
69
70 add(applet);
71 applet.setStub(this);
72 applet.init();
73 show();
74 applet.start();
75 }
76
77
79 public void appletResize(int width, int height) {
80 }
81
82 public AppletContext getAppletContext() {
83 return this;
84 }
85
86 public URL getCodeBase() {
87 return null;
88 }
89
90 public URL getDocumentBase() {
91 return null;
92 }
93
94 public String getParameter(String name) {
95 return (String)_params.get(name);
96 }
97
98 public boolean isActive() {
99 return true;
100 }
101
102
104 public Applet getApplet(String name) {
105 return null;
106 }
107
108 public Enumeration getApplets() {
109 return null;
110 }
111
112 public AudioClip getAudioClip(URL url) {
113 return null;
114 }
115
116 public Image getImage(URL url) {
117 return null;
118 }
119
120 public InputStream getStream(String key) {
121 return null;
122 }
123
124 public Iterator getStreamKeys() {
125 return null;
126 }
127
128 public void setStream(String key, InputStream stream) {
129 }
130
131 public void showDocument(URL url) {
132 }
133
134 public void showDocument(URL url, String target) {
135 }
136
137 public void showStatus(String status) {
138 }
139
140 private Map _params;
141
142 }