home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Laura Lemay's Web Workshop: ActiveX & VBScript
/
Laura_Lemays_Web_Workshop_ActiveX_and_VBScript_Version_1.0_1997.iso
/
source
/
chapter15
/
15lax01.java
next >
Wrap
Text File
|
1996-09-26
|
1KB
|
41 lines
import java.awt.*;
public class Mercutio extends java.applet.Applet {
Button b = new Button("Speak!");
TextField t = new TextField(45);
int phrase = 0;
public void init() {
String bt = getParameter("ButtonTitle");
if (bt != null)
b.setLabel(bt);
add(b);
add(t);
}
public boolean action(Event evt, Object obj) {
if (++phrase > 5) phrase = 0;
switch (phrase) {
case 0:
t.setText("If love be rough with you, be rough with love.");
break;
case 1:
t.setText("Dost thou make us minstrels?");
break;
case 2:
t.setText("Speak but one rhyme, and I am satisfied.");
break;
case 3:
t.setText("Any man that can write may answer a letter.");
break;
case 4:
t.setText("Go, villain, fetch a surgeon.");
break;
default:
t.setText("They have made worms' meat of me.");
}
repaint();
return false;
}
}