Java:applet viewer
Résolu
domxaline
-
domxaline -
domxaline -
Bonjour,
j'ai écris ce prg en exécutant,il y a qu'un seul bouton
avec "click to know the answer"
veuillez m'aidez pour résoudre ce problem svp
<code
<html>
<head>
<title>Questions and Answers</title>
</head>
<body>
<applet code=Question.class
width=400 height=100>
<param name=question value="What is Inheritance?">
<param name=answer value="Getting the properties of one class into another">
</applet>
</body>
</html>
</code>
j'ai écris ce prg en exécutant,il y a qu'un seul bouton
avec "click to know the answer"
veuillez m'aidez pour résoudre ce problem svp
<code
<html>
<head>
<title>Questions and Answers</title>
</head>
<body>
<applet code=Question.class
width=400 height=100>
<param name=question value="What is Inheritance?">
<param name=answer value="Getting the properties of one class into another">
</applet>
</body>
</html>
</code>
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class Question extends Applet implements ActionListener
{
String theQuestion;
String theAnswer="";
Button reveal=new Button("Click to know the answer");
public void init()
{
theQuestion=getParameter("ques");
add(reveal);
reveal.addActionListener(this);
}
public void pain(Graphics g)
{
g.setColor(Color.black);
g.drawString(theQuestion, 10,50);
g.setColor(Color.red);
g.drawString(theAnswer, 10, 70);
}
public void actionPerformed(ActionEvent e)
{
theQuestion=getParameter("question");
theAnswer=getParameter("answer");
repaint();
}
}
A voir également:
- Java:applet viewer
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Waptrick java voiture - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages