MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.applet.AppletContext;
import java.awt.Graphics;
import java.net.URL;

import javax.swing.JApplet;

public class MainClass extends JApplet {

    public void paint(Graphics g) {
        AppletContext ac = getAppletContext();
        try {
            URL url = new URL("http://www.java2s.com");
            ac.showDocument(url, "frame2");
        } catch (Exception e) {
            showStatus("Exception: " + e);
        }
        g.drawString("ShowDocument Applet", 10, 25);
    }
}