39 |
import gnu.java.awt.EmbeddedWindow; |
import gnu.java.awt.EmbeddedWindow; |
40 |
import gnu.getopt.Getopt; |
import gnu.getopt.Getopt; |
41 |
import gnu.getopt.LongOpt; |
import gnu.getopt.LongOpt; |
|
import java.io.*; |
|
42 |
import java.applet.Applet; |
import java.applet.Applet; |
|
import java.awt.Dimension; |
|
43 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
44 |
|
import java.awt.Dimension; |
45 |
import java.awt.Frame; |
import java.awt.Frame; |
46 |
|
import java.awt.Menu; |
47 |
|
import java.awt.MenuBar; |
48 |
|
import java.awt.MenuItem; |
49 |
|
import java.awt.event.WindowAdapter; |
50 |
|
import java.awt.event.WindowEvent; |
51 |
|
import java.io.IOException; |
52 |
import java.util.Map; |
import java.util.Map; |
53 |
import java.util.HashMap; |
import java.util.HashMap; |
54 |
import java.util.List; |
import java.util.List; |
57 |
import java.net.URL; |
import java.net.URL; |
58 |
import java.net.URLClassLoader; |
import java.net.URLClassLoader; |
59 |
|
|
60 |
public class AppletViewer extends Frame |
public class AppletViewer extends WindowAdapter |
61 |
{ |
{ |
62 |
Applet applet; |
public class ViewerWindow extends Frame |
63 |
AppletTag tag; |
{ |
64 |
static List appletTags = new ArrayList (); |
public ViewerWindow (String title, int width, int height, Applet applet) |
65 |
|
{ |
66 |
|
setLayout (new BorderLayout()); |
67 |
|
add (applet, BorderLayout.CENTER); |
68 |
|
|
69 |
|
addNotify(); |
70 |
|
|
71 |
|
MenuBar menuBar = new MenuBar(); |
72 |
|
Menu menuFile = new Menu ("File"); |
73 |
|
menuBar.add (menuFile); |
74 |
|
menuFile.add (new MenuItem ("Quit")); |
75 |
|
setMenuBar (menuBar); |
76 |
|
|
77 |
|
setSize (width, height); |
78 |
|
setVisible (true); |
79 |
|
} |
80 |
|
} |
81 |
|
|
82 |
public AppletViewer (AppletTag tag) throws IOException |
public class PluginWindow extends EmbeddedWindow |
83 |
{ |
{ |
84 |
super(tag.documentbase.toString()); |
public PluginWindow (int window_id, int width, int height, Applet applet) |
85 |
|
{ |
86 |
|
super (window_id); |
87 |
|
|
88 |
|
addNotify(); |
89 |
|
|
90 |
|
setLayout (new BorderLayout()); |
91 |
|
add (applet, BorderLayout.CENTER); |
92 |
|
|
93 |
|
setSize (width, height); |
94 |
|
setVisible (true); |
95 |
|
} |
96 |
|
} |
97 |
|
|
98 |
setLayout(new BorderLayout()); |
static List appletTags = new ArrayList(); |
99 |
|
|
100 |
|
Applet applet; |
101 |
|
AppletTag tag; |
102 |
|
Frame appletWindow; |
103 |
|
|
104 |
|
public AppletViewer (AppletTag tag) |
105 |
|
throws IOException |
106 |
|
{ |
107 |
this.tag = tag; |
this.tag = tag; |
108 |
|
|
109 |
applet = createApplet(this.tag); |
applet = createApplet (this.tag); |
110 |
|
|
111 |
addNotify(); |
appletWindow = new ViewerWindow (tag.documentbase.toString(), |
112 |
|
tag.dimensions.width, |
113 |
setSize (tag.dimensions.width, tag.dimensions.height); |
tag.dimensions.height, |
114 |
|
applet); |
115 |
add (applet, BorderLayout.CENTER); |
appletWindow.addWindowListener (this); |
116 |
|
|
117 |
applet.init(); |
applet.init(); |
118 |
applet.validate(); |
applet.validate(); |
119 |
applet.start(); |
applet.start(); |
120 |
|
} |
121 |
|
|
122 |
setVisible( true); |
public void windowClosing (WindowEvent event) |
123 |
|
{ |
124 |
|
applet.stop(); |
125 |
|
appletWindow.hide(); |
126 |
|
System.exit (0); |
127 |
} |
} |
128 |
|
|
129 |
public static Applet createApplet(AppletTag tag) |
public static Applet createApplet(AppletTag tag) |
241 |
dimensions.width = (int) (1.6 * dimensions.height); |
dimensions.width = (int) (1.6 * dimensions.height); |
242 |
|
|
243 |
System.out.println (dimensions); |
System.out.println (dimensions); |
244 |
|
|
245 |
boolean classFileGiven = false; |
boolean classFileGiven = false; |
246 |
for (int i = opts.getOptind (); i < args.length; i++) |
for (int i = opts.getOptind (); i < args.length; i++) |
247 |
{ |
{ |
248 |
if (args[i].endsWith(".class")) |
if (args[i].endsWith(".class")) |
249 |
{ |
{ |
250 |
classFileGiven = true; |
classFileGiven = true; |
251 |
|
|
252 |
String[] paramArray = null; |
String[] paramArray = null; |
253 |
|
|
254 |
if (parameters != null) |
if (parameters != null) |