Java-Applet: Dessiner un texte sur une applet

Author:

Java-Applet:  Dessiner un texte sur une applet
Download

/***** Code de MesExemples.com *******/
import java.applet.Applet;
import java.awt.Graphics;
 
public class applet extends Applet{
 
	public void paint(Graphics g)
		{
			//Ecrire un texte avec la méthode drawString
			g.drawString("Ma première Applet",20,100);
		}
}
Code HTML d'exécution de l'applet
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//FR">
 
<html>
	<head>
	</head>
	<body bgcolor="000000">
		<center>
			<applet
				code	= "applet.class"
				width	= "500"
				height	= "300"
				>
			</applet>
		</center>
	</body>
</html>

Cet article Java-Applet: Dessiner un texte sur une applet est apparu en premier sur .