001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.lawt;
022:
023: import java.applet.Applet;
024: import java.applet.AppletContext;
025: import java.applet.AppletStub;
026: import java.applet.AudioClip;
027:
028: import java.awt.Frame;
029: import java.awt.Image;
030: import java.awt.event.WindowAdapter;
031: import java.awt.event.WindowEvent;
032:
033: import java.io.InputStream;
034:
035: import java.net.URL;
036:
037: import java.util.Enumeration;
038: import java.util.HashMap;
039: import java.util.Iterator;
040: import java.util.Map;
041:
042: /**
043: * <a href="AppletFrame.java.html"><b><i>View Source</i></b></a>
044: *
045: * @author Brian Wing Shun Chan
046: *
047: */
048: public class AppletFrame extends Frame implements AppletStub,
049: AppletContext {
050:
051: public AppletFrame(Applet applet, int x, int y) {
052: this (applet, new HashMap(), x, y);
053: }
054:
055: public AppletFrame(Applet applet, Map params, int x, int y) {
056: setTitle(applet.getClass().getName());
057: setSize(x, y);
058:
059: _params = params;
060:
061: addWindowListener(new WindowAdapter() {
062: public void windowClosing(WindowEvent e) {
063: System.exit(0);
064: }
065: });
066:
067: add(applet);
068: applet.setStub(this );
069: applet.init();
070: show();
071: applet.start();
072: }
073:
074: // AppletStub methods
075:
076: public void appletResize(int width, int height) {
077: }
078:
079: public AppletContext getAppletContext() {
080: return this ;
081: }
082:
083: public URL getCodeBase() {
084: return null;
085: }
086:
087: public URL getDocumentBase() {
088: return null;
089: }
090:
091: public String getParameter(String name) {
092: return (String) _params.get(name);
093: }
094:
095: public boolean isActive() {
096: return true;
097: }
098:
099: // AppletContext methods
100:
101: public Applet getApplet(String name) {
102: return null;
103: }
104:
105: public Enumeration getApplets() {
106: return null;
107: }
108:
109: public AudioClip getAudioClip(URL url) {
110: return null;
111: }
112:
113: public Image getImage(URL url) {
114: return null;
115: }
116:
117: public InputStream getStream(String key) {
118: return null;
119: }
120:
121: public Iterator getStreamKeys() {
122: return null;
123: }
124:
125: public void setStream(String key, InputStream stream) {
126: }
127:
128: public void showDocument(URL url) {
129: }
130:
131: public void showDocument(URL url, String target) {
132: }
133:
134: public void showStatus(String status) {
135: }
136:
137: private Map _params;
138:
139: }
|