If you write a applet, it should have another structure than a stand-alone app, this is because you have other environments inside browser than you have stand-alone.
When running your app as an applet, you have a fixed screen, and you can't send text to it, and can basically use only the screenspace the browser has provided.
When running it as stand alone, you basicly have more power, and can access more things without security exception, but most importantly, you also need to do the graphical user interface things by yourself.
Example:
public class HelloWorld extends JApplet {
//Called when this applet is loaded into the browser.
public void init() {
//Execute a job on the event-dispatching thread; creating this applet's GUI.
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JLabel lbl = new JLabel("Hello World");
add(lbl);
}
});
} catch (Exception e) {
System.err.println("createGUI didn't complete successfully");
}
}
}
Example from: Oracle Aplet Getting started (Requires java plugin to view)
Create a jar from it using:
javac HelloWorld.jar
jar cf Hello.jar Hello.class
Then run it in browser using:
<h2> Hello Test </h2>
<APPLET
CODE="HelloWorld"
WIDTH="50%" HEIGHT="50"
ARCHIVE = "Hello.jar"
> This example uses a Hello.jar applet.</APPLET>