1*489fe5beSAndrew Rist /**************************************************************
2*489fe5beSAndrew Rist  *
3*489fe5beSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*489fe5beSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*489fe5beSAndrew Rist  * distributed with this work for additional information
6*489fe5beSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*489fe5beSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*489fe5beSAndrew Rist  * "License"); you may not use this file except in compliance
9*489fe5beSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*489fe5beSAndrew Rist  *
11*489fe5beSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*489fe5beSAndrew Rist  *
13*489fe5beSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*489fe5beSAndrew Rist  * software distributed under the License is distributed on an
15*489fe5beSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*489fe5beSAndrew Rist  * KIND, either express or implied.  See the License for the
17*489fe5beSAndrew Rist  * specific language governing permissions and limitations
18*489fe5beSAndrew Rist  * under the License.
19*489fe5beSAndrew Rist  *
20*489fe5beSAndrew Rist  *************************************************************/
21*489fe5beSAndrew Rist 
22cdf0e10cSrcweir import java.awt.Graphics;
23cdf0e10cSrcweir import java.awt.Color;
24cdf0e10cSrcweir import java.io.File;
25cdf0e10cSrcweir import java.io.IOException;
26cdf0e10cSrcweir import java.net.URL;
27cdf0e10cSrcweir import java.io.InputStream;
28cdf0e10cSrcweir import java.net.MalformedURLException;
29cdf0e10cSrcweir /*
30cdf0e10cSrcweir  * TestApplet.java
31cdf0e10cSrcweir  *
32cdf0e10cSrcweir  * Created on 21. November 2001, 09:37
33cdf0e10cSrcweir  */
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /**
36cdf0e10cSrcweir  *
37cdf0e10cSrcweir  * @author  jl97489
38cdf0e10cSrcweir  * @version
39cdf0e10cSrcweir  */
40cdf0e10cSrcweir public class TestApplet extends java.applet.Applet {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     /** Initialization method that will be called after the applet is loaded
43cdf0e10cSrcweir      *  into the browser.
44cdf0e10cSrcweir      */
init()45cdf0e10cSrcweir     public void init () {
46cdf0e10cSrcweir         setBackground( Color.green);
47cdf0e10cSrcweir         resize( 300, 300);
48cdf0e10cSrcweir 
49cdf0e10cSrcweir         // Security tests.
50cdf0e10cSrcweir         File f= new File("d:\\temp\\javasecurity.txt");
51cdf0e10cSrcweir         SecurityManager mgr= System.getSecurityManager();
52cdf0e10cSrcweir         try {
53cdf0e10cSrcweir             f.createNewFile();
54cdf0e10cSrcweir 
55cdf0e10cSrcweir         // local connection
56cdf0e10cSrcweir         URL url= new URL("http://localhost:8080/index.html");
57cdf0e10cSrcweir         InputStream is= url.openStream();
58cdf0e10cSrcweir         // remote connection
59cdf0e10cSrcweir         url= new URL("http://www.w3.org/index.html");
60cdf0e10cSrcweir         is= url.openStream();
61cdf0e10cSrcweir         }catch( MalformedURLException mue) {
62cdf0e10cSrcweir         }catch( IOException e) {
63cdf0e10cSrcweir             String s= e.getMessage();
64cdf0e10cSrcweir             System.out.println(s);
65cdf0e10cSrcweir         }catch( SandboxSecurityException sse) {
66cdf0e10cSrcweir             String s= sse.getMessage();
67cdf0e10cSrcweir             System.out.println("s");
68cdf0e10cSrcweir         }
69cdf0e10cSrcweir         //        catch( Exception ex) {
70cdf0e10cSrcweir //            String s= ex.getMessage();
71cdf0e10cSrcweir //            ex.printStackTrace();
72cdf0e10cSrcweir //        }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     }
75cdf0e10cSrcweir 
paint( Graphics g)76cdf0e10cSrcweir     public void paint( Graphics g) {
77cdf0e10cSrcweir         super.paint( g);
78cdf0e10cSrcweir     }
79cdf0e10cSrcweir }
80