Okay, so I did a little applet tutorial, and I read that the init()
method is required for an applet to run. And it does. At least in my IDE (Eclipse). The Applet Viewer has no problems running my applet, when I try to do the <applet>
tag in HTML, nothing displays, but it acts as though something is there (text position is altered by the tag). Here is my applet:
import java.awt.*;
import javax.swing.*;
public class Applet extends JApplet{
public void init(){
Label label = new Label("Hello!");
this.add(label);
}
}
And this is the code I'm using on my webpage:
<applet code="Applet.class" width=100 height=100></applet>
Even if I remove the width/height parameters, I get the same result (it doesn't display on the page). Yes, the path to the applet is correct and in the same directory. Thank you for your help.
If it helps, this is my DOCTYPE
:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Finally, after scouring the console, I found this:
Could not read chrome manifest file '/usr/lib/firefox-8.0/extensions
/{972ce4c6-7e08-4474-a285-3208198ce6fd}/chrome.manifest'.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…