diff options
Diffstat (limited to 'stoc/test/javavm/testapplet/TestApplet.java')
-rw-r--r-- | stoc/test/javavm/testapplet/TestApplet.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/stoc/test/javavm/testapplet/TestApplet.java b/stoc/test/javavm/testapplet/TestApplet.java new file mode 100644 index 000000000000..07467cc54c0f --- /dev/null +++ b/stoc/test/javavm/testapplet/TestApplet.java @@ -0,0 +1,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); + } +} |