-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIRDSApplets.java
88 lines (81 loc) · 2.22 KB
/
SIRDSApplets.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// SIRDS Applet Manager
//
// By Benito van der Zander - http://www.benibela.de
// Based on AbSIRDlet of Lewey Geselowitz - http://www.leweyg.com
import java.awt.event.*;
import java.awt.image.*;
import java.applet.*;
import java.util.*;
import java.awt.*;
import java.net.*;
public class SIRDSApplets extends SIRDSAppletManager
{
@Override
public void init()
{
if (Locale.getDefault() != null)
if (Locale.getDefault().equals(Locale.GERMAN) || Locale.getDefault().equals(Locale.GERMANY) )
Translations.setInstance(new Translations_DE());
registerSIRDSlet(new SIRDSFlighter());
registerSIRDSlet(new SIRDSxkcd());
registerSIRDSlet(new AbSIRDlet());
registerSIRDSlet(new SIRDSFlighterEditor());
super.init();
}
//applet stand alone execution
static class MockAppletStub implements AppletStub{
String path,documentPath;
public MockAppletStub(String baseFileName){
documentPath=baseFileName;
path=documentPath.substring(0,documentPath.lastIndexOf("/")+1);
}
public void appletResize(int width, int height){
return;
}
public AppletContext getAppletContext(){
return null;
}
public URL getCodeBase(){
try{
return new URL(path);
} catch (MalformedURLException e){
return null;
}
}
public URL getDocumentBase(){
try{
return new URL(documentPath);
} catch (MalformedURLException e){
return null;
}
}
public String getParameter(String name){
return "";
}
public boolean isActive(){
return true;
}
}
public static void main(String args[]){
Window w = new Frame();
w.addWindowListener(new WindowAdapter(){
public void windowClosing (WindowEvent event)
{
System.exit(0);
}
});
SIRDSApplets sa=new SIRDSApplets();
sa.setSize(620,640);
w.setSize(620,640);
w.add(sa);
MockAppletStub stub=new MockAppletStub(sa.getClass().getClassLoader().getResource("SIRDSApplets.class").toString());
sa.setStub(stub);
System.out.println(stub.getCodeBase().toString());//Class().getClassLoader().getResource("SIRDSApplets.class").toString());
sa.setFont(new Font("Dialog",0,11));
sa.init();
sa.start();
w.setVisible(true);
sa.run();
}
}