Bonjour, je suis débutant dans la constructions d'applet.
Je voudrais savoir comment faire pour ne plus avoir l'erreur "applet non initialisé". Je ne sais pas ce que ça veut dire. Pourtant je suis sure que mon code est bon.
Je programme sous eclipse 3.2 avec JAVA 5.0.
Merci de vos réponses.
Alex
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 package Question1; import java.applet.Applet; import java.awt.*; public class Question1 extends Applet { String msg; Point position; Image img; String fichierImage; public void init() { String str; msg = getParameter("Message"); str = getParameter("taillePolice"); int taille = Integer.parseInt(str); str = getParameter("xpos"); int xpos = Integer.parseInt(str); str = getParameter("ypos"); int ypos = Integer.parseInt(str); position = new Point(xpos, ypos); String police = getParameter("typePolice"); Font font = new Font(police, Font.BOLD, taille); setFont(font); fichierImage = getParameter("image"); img = getImage(getDocumentBase(), fichierImage); } public void paint(Graphics g) { g.drawString(msg, position.x, position.y); g.drawImage(img, position.x, position.y+5, this); } }
Partager