package appletexample; import javax.swing.*; /** * * @author Pete Cappello */ public class Main extends JApplet { /** * Invoked when this applet is loaded into the web browser. */ @Override public void init() { try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { JLabel label = new JLabel( "Hello, world!"); add( label ); } } ); } catch ( Exception exception ) { exception.printStackTrace(); } } }