// Importations
import java.awt.Graphics ;
import java.awt.Image ;
public class tipsImg1 extends java.applet.Applet {
// Variables
Image img ; // ...
// Init
public void init() { // Methode init()
// Read image
// getCodeBase() is a base directory
// to read this image
img = getImage(getCodeBase(), "./photo.gif") ;
}
// Draw l'applet
public void paint(Graphics g) { // Methode paint()
// Draw image at the position 5/10
g.drawImage(img, 5, 10, this) ;
}
}
|