12
12
import javax.swing.JFrame;
15
* This class simplifies running Applets as applications
16
* It mirrors the actions of a Browser in an application.
17
* The methods without specific JavaDoc comments mirror the methods
18
* of AppletStub and AppletContext, returning null, true, this or ""
20
* TODO: Maybe it is possible to have main in here using a static
21
* method to find the applet object... Maybe not.
23
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
24
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
25
* Distribution Licence:<br />
26
* Project B is free software; you can redistribute it
27
* and/or modify it under the terms of the GNU General Public License,
28
* version 2 as published by the Free Software Foundation.<br />
29
* This program is distributed in the hope that it will be useful,
30
* but WITHOUT ANY WARRANTY; without even the implied warranty of
31
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32
* General Public License for more details.<br />
33
* The License is available on the internet
34
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
35
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
36
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
37
* The copyright to this program is held by it's authors.
38
* </font></td></tr></table>
39
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
40
* @see <{docs.Licence}>
15
* This class simplifies running Applets as applications
16
* It mirrors the actions of a Browser in an application.
17
* The methods without specific JavaDoc comments mirror the methods
18
* of AppletStub and AppletContext, returning null, true, this or ""
20
* TODO: Maybe it is possible to have main in here using a static
21
* method to find the applet object... Maybe not.
23
* <p><table border='1' cellPadding='3' cellSpacing='0'>
24
* <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
26
* Distribution Licence:<br />
27
* JSword is free software; you can redistribute it
28
* and/or modify it under the terms of the GNU General Public License,
29
* version 2 as published by the Free Software Foundation.<br />
30
* This program is distributed in the hope that it will be useful,
31
* but WITHOUT ANY WARRANTY; without even the implied warranty of
32
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33
* General Public License for more details.<br />
34
* The License is available on the internet
35
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
36
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
37
* MA 02111-1307, USA<br />
38
* The copyright to this program is held by it's authors.
39
* </font></td></tr></table>
41
* @author Joe Walker [joe at eireneh dot com]
43
44
public class AppletFrame extends JFrame
46
* Creates a Frame and runs an Applet in the frame.
47
* Mirrors the actions of a Browser in an application.
48
* @param name The text that should appear in the title bar.
49
* @param app The Applet that we should run in the new frame.
50
* @param width The horizontal size of the frame.
51
* @param height The vertical size of the frame.
47
* Creates a Frame and runs an Applet in the frame.
48
* Mirrors the actions of a Browser in an application.
49
* @param name The text that should appear in the title bar.
50
* @param app The Applet that we should run in the new frame.
51
* @param width The horizontal size of the frame.
52
* @param height The vertical size of the frame.
53
54
public AppletFrame(String name, Applet app, int width, int height)
55
56
addWindowListener(new WindowAdapter() {
72
* Creates a Frame and runs an Applet in the frame.
73
* The frame is given the default name of the Applet Class.
74
* @param app The Applet that we should run in the new frame.
75
* @param width The horizontal size of the frame.
76
* @param height The vertical size of the frame.
73
* Creates a Frame and runs an Applet in the frame.
74
* The frame is given the default name of the Applet Class.
75
* @param app The Applet that we should run in the new frame.
76
* @param width The horizontal size of the frame.
77
* @param height The vertical size of the frame.
78
79
public AppletFrame(Applet app, int width, int height)
80
81
this(app.getClass().getName(), app, width, height);
84
* Creates a Frame and runs an Applet in the frame.
85
* The frame is given the default name of the Applet Class.
86
* @param name The text that should appear in the title bar.
87
* @param app The Applet that we should run in the new frame.
85
* Creates a Frame and runs an Applet in the frame.
86
* The frame is given the default name of the Applet Class.
87
* @param name The text that should appear in the title bar.
88
* @param app The Applet that we should run in the new frame.
89
90
public AppletFrame(String name, Applet app)
91
92
this(name, app, 100, 100);
117
* So that we can be an AppletStub
118
* So that we can be an AppletStub
119
120
public class AppletFrameStub implements AppletStub
121
public boolean isActive() { return true; }
122
public URL getDocumentBase() { return null; }
123
public URL getCodeBase() { return null; }
122
public boolean isActive() { return true; }
123
public URL getDocumentBase() { return null; }
124
public URL getCodeBase() { return null; }
124
125
public String getParameter(String name) { return ""; }
125
126
public AppletContext getAppletContext() { return null; }
126
127
public void appletResize(int w, int h) { }