I’m trying to get a Java Applet to display on a webpage. The applet runs in Eclipse, but does nothing on the webpage.
For reference here is the applet (no, it’s not complete):
package TestProg.webClient;
import java.applet.Applet;
import java.awt.*;
public class UserLogin extends Applet {
String accountId = "";
public void init() {
TextField username = new TextField(10);
TextField password = new TextField(10);
Button login = new Button(" Log In ");
add(username);
add(password);
add(login);
}
}
And here is the HTML code:
<body>
<center>
<div id="title"><h1>UserLogin</h1></div>
</center>
<applet code="sp.jar" width="400" height="100" alt="This isn't working"></applet>
</body>
I’ve also tried embedding with <object> and <embed>, have tried with both Chrome and Firefox on a Linux machine, and for some reason took the .class file out of the .jar and tried that.
Absolutely nothing displays on the webpage.
Any help would be greatly appreciated.
Richard
I discovered what the problem was, and there seems to be a severe lacking of this knowledge out there….
The HTML tag should look like this…
<applet code=NameOfPackage.NameOfApplet archive=NameOfApplet.jar width=300 height=300>Thanks to all who helped…