Friday, March 11, 2005

How to write a Swing applet

Template:
// html:    <applet code="SwingApplet.class" archive="SwingApplet.jar" width="500" height="250"></applet>
// compile: javac -g:none -O -deprecation SwingApplet.java
// pack:    jar cvf SwingApplet.jar *
// run:     appletviewer SwingApplet.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class SwingApplet extends JApplet {
    getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    public void init() {
        super.init();
        createFrame();
    }

    void createFrame() {
        createContentPane();
        createMenuBar();
        createToolBar();
    }

    void createContentPane() {
    }

    void createMenuBar() {
    }

    void createToolBar() {
    }
}

No comments: