home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day27
/
AppletTest.java
< prev
next >
Wrap
Text File
|
2002-05-26
|
533b
|
23 lines
import java.applet.Applet;
import java.awt.*;
public class AppletTest extends Applet {
Font f = new Font("TimesRoman", Font.BOLD, 36);
boolean useRed = true;
public void paint(Graphics screen) {
screen.setFont(f);
if (useRed)
screen.setColor(Color.red);
else
screen.setColor(Color.blue);
screen.drawString("This is an applet!", 5, 30);
}
public boolean mouseDown(Event evt, int x, int y) {
useRed = !useRed;
repaint();
return true;
}
}