blob: 07467cc54c0f55a23dc06c2c2c9a76db59db0007 (
plain)
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
|
import java.awt.Graphics;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.io.InputStream;
import java.net.MalformedURLException;
import com.sun.star.lib.sandbox.*;
/*
* TestApplet.java
*
* Created on 21. November 2001, 09:37
*/
/**
*
* @author jl97489
* @version
*/
public class TestApplet extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init () {
setBackground( Color.green);
resize( 300, 300);
// Security tests.
File f= new File("d:\\temp\\javasecurity.txt");
SecurityManager mgr= System.getSecurityManager();
try {
f.createNewFile();
// local connection
URL url= new URL("http://localhost:8080/index.html");
InputStream is= url.openStream();
// remote connection
url= new URL("http://www.w3.org/index.html");
is= url.openStream();
}catch( MalformedURLException mue) {
}catch( IOException e) {
String s= e.getMessage();
System.out.println(s);
}catch( SandboxSecurityException sse) {
String s= sse.getMessage();
System.out.println("s");
}
// catch( Exception ex) {
// String s= ex.getMessage();
// ex.printStackTrace();
// }
}
public void paint( Graphics g) {
super.paint( g);
}
}
|