java - How to add an applet to a webpage -
i'm trying make applet website, can't put applet on website.
this html code
<html> <body> <p>test</p> <applet code="testcreator.class" width="400" height="400"> </applet> </body> </html>
my applet code
package me.zachary.self; import java.applet.applet; import java.awt.graphics; import javax.swing.japplet; public class testcreator extends japplet { public void paint(graphics g) { super.paint(g); g.drawstring("test", 100, 100); } }
the testcreator.class in same directory html file, whenever open html file appears "test" ("test" uppercase t, not "test" applet).
what doing wrong , / or how fix it?
thanks
i suggest read why cs teachers should stop teaching java applets.
i think
<applet code="testcreator.class"
shouldn't end in .class
. should include package. like,
<applet code="me.zachary.self.testcreator"
and might find easier test applet appletviewer.
Comments
Post a Comment