Java source:
/* ImageApplet.java
*/
import java.applet.*;
import java.awt.*;
import java.net.*;
public class ImageApplet extends Applet{
private image image = null;
public void init(){
try{
URL imageURL = new URL(getDocumentBase(),"EinsteinBike.jpg");
image = getImage(imageURL);
}catch(MalformedURLException murle){
getAppletContext().showStatus("Image could not be loaded.");
}
}
public void paint(Graphics graphics){
graphics.drawImage(image,0,0,this);
}
}
html source:
<html>
<head>
<title>ImageApplet</title>
</head>
<body>
<h2 align="center">ImageApplet</h2>
<center><applet code="ImageApplet.class" codebase = "."
width="244" height="216">
alt="Your browser understands the <APPLET> tag
but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET>
tag!
</applet></center>
<center>Back to the main menu</center>
</body>
</html>