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 36 37 38 39 40 41 42 43 44 45 46 47
|
import java.awt.*;
//import java.applet.*;
public class Grand_numero
{
TextField text1,text2,text3;
public void init()
{
text1=new TextField(8);
text2=new TextField(8);
text3=new TextField(8);
text1.setText("0");
text2.setText("0");
text3.setText("0");
}
public void paint(Graphics g)
{
int x=0,y=0,z=0;
String s1,s2,s3,s;
g.drawString("input a number in each box", 10, 50);
s1=text1.getText();
x=Integer.parseInt(s1);
s2=text2.getText();
y=Integer.parseInt(s2);
s3=text3.getText();
z=Integer.parseInt(s3);
if(x>y&&x>z)
{
s=String.valueOf(x);
}
else if(y>z)
{
s=String.valueOf(y);
}
else
{
s=String.valueOf(z);
}
g.drawString("The great value:", 10, 75);
g.drawString(s, 100,75);
}
public Boolean action(Event event,Object object)
{
return true;
repaint();
}
} |
Partager