SOLVED: Embedding JApplet into webpage first time, nothing shows?
I've been working on a project locally and it's going great, and I figure it's time to start seeing how it runs on the web. The project will have a jar file with all the classes used, and the archive tag will point to my main GUI class. Still not sure if all that will work.
Anyway I got the jar file on the site and the html page coded, and a box the right size comes up but nothing is displayed. I figure I'd test it with the JApplet java uses when talking about applets in the beginning
Code:
import javax.swing.JApplet;
import javax.swing.SwingUtilities;
import javax.swing.JLabel;
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");
}
}
}
my web code is
Code:
<html>
<head>
<title> favorites / bookmark title goes here </title>
</head>
<body bgcolor="black" text="white">
<APPLET CODE="HelloWorld.class" WIDTH=800 HEIGHT=789>
</APPLET>
</body>
</html>
Here is a link to what's going on. I know the size is huge but this shouldn't affect it from showing.
Any help is appreciated, this is exciting regardless!
UPDATE -- Just read here that they are using a JNLP file and the <script> tags to load this onto the page. Is this necessary? Advantageous?