fuin.org
Small Open Source Java Tools and Libraries
SimpleAppletViewer
Easily start any applet from a main method or from within your application.This is a replacement for Sun's Java Applet Viewer.
Example source:
package org.fuin.utils4swing.appletviewer;
import javax.swing.SwingUtilities;
import org.fuin.utils4swing.common.Utils4Swing;
/**
* Shows how to run the Applet Viewer programmatically.
*/
public final class Examples {
/**
* Private constructor.
*/
private Examples() {
throw new UnsupportedOperationException(
"Creating an instance is not allowed (utility class!)!");
}
/**
* Start the example.
*
* @param args
* Not used.
*/
public static void main(final String[] args) {
final SimpleAppletViewerConfig appletViewerConfig = new SimpleAppletViewerConfig();
appletViewerConfig.setApplet(new HelloWorldApplet());
appletViewerConfig.addArgument("useless", "1");
appletViewerConfig.addArgument("dummy", "2");
appletViewerConfig.addArgument("arguments", "3");
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Utils4Swing.initSystemLookAndFeel();
(new SimpleAppletViewer(appletViewerConfig)).execute();
}
});
}
}