~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/common/org/crosswire/common/swing/AppletFrame.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import javax.swing.JFrame;
13
13
 
14
14
/**
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 ""
19
 
* where appropriate.
20
 
* TODO: Maybe it is possible to have main in here using a static
21
 
* method to find the applet object... Maybe not.
22
 
*
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}>
41
 
* @author Joe Walker
42
 
*/
 
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 ""
 
19
 * where appropriate.
 
20
 * TODO: Maybe it is possible to have main in here using a static
 
21
 * method to find the applet object... Maybe not.
 
22
 * 
 
23
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 
24
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 
25
 *
 
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>
 
40
 * @see docs.Licence
 
41
 * @author Joe Walker [joe at eireneh dot com]
 
42
 * @version $Id$
 
43
 */
43
44
public class AppletFrame extends JFrame
44
45
{
45
46
    /**
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.
52
 
    */
 
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
     */
53
54
    public AppletFrame(String name, Applet app, int width, int height)
54
55
    {
55
56
        addWindowListener(new WindowAdapter() {
69
70
    }
70
71
 
71
72
    /**
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.
77
 
    */
 
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
     */
78
79
    public AppletFrame(Applet app, int width, int height)
79
80
    {
80
81
        this(app.getClass().getName(), app, width, height);
81
82
    }
82
83
 
83
84
    /**
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.
88
 
    */
 
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
     */
89
90
    public AppletFrame(String name, Applet app)
90
91
    {
91
92
        this(name, app, 100, 100);
95
96
    }
96
97
 
97
98
    /**
98
 
    * Creates a Frame and runs an Applet in the frame.
99
 
    * The frame is given the default name of the Applet Class.
100
 
    * @param app The Applet that we should run in the new frame.
101
 
    */
 
99
     * Creates a Frame and runs an Applet in the frame.
 
100
     * The frame is given the default name of the Applet Class.
 
101
     * @param app The Applet that we should run in the new frame.
 
102
     */
102
103
    public AppletFrame(Applet app)
103
104
    {
104
105
        this(app.getClass().getName(), app);
105
106
    }
106
107
 
107
108
    /**
108
 
    * Close everything down and exit from the JVM
109
 
    */
 
109
     * Close everything down and exit from the JVM
 
110
     */
110
111
    public void close()
111
112
    {
112
113
        dispose();
114
115
    }
115
116
 
116
117
    /**
117
 
    * So that we can be an AppletStub
118
 
    */
 
118
     * So that we can be an AppletStub
 
119
     */
119
120
    public class AppletFrameStub implements AppletStub
120
121
    {
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)  { }
129
130
    /** Are we still running */
130
131
    private boolean dying = false;
131
132
}
132