home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java by Example
/
jbecd.bin
/
JBE-CD
/
NTUsers
/
JBECODE.ZIP
/
JavaByExample
/
chap13
/
Applet17.java
< prev
next >
Wrap
Text File
|
1996-02-13
|
832b
|
40 lines
import java.awt.*;
import java.applet.*;
public class Applet17 extends Applet
{
TextField textField[];
int avg[];
public void init()
{
textField = new TextField[3];
avg = new int[3];
for (int x=0; x<3; ++x)
{
textField[x] = new TextField(5);
add(textField[x]);
textField[x].setText("0");
}
}
public void paint(Graphics g)
{
g.drawString("Your bowlers' averages are: ", 50, 80);
for (int x=0; x<3; ++x)
{
String s = textField[x].getText();
g.drawString(s, 75, 110 + x*15);
avg[x] = Integer.parseInt(s);
}
}
public boolean action(Event event, Object arg)
{
repaint();
return true;
}
}