home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 July & August
/
Pcwk78a98.iso
/
Internet
/
Javadraw
/
DATA.Z
/
CrazyText.java
< prev
next >
Wrap
Text File
|
1995-10-08
|
2KB
|
73 lines
// CrazyText.java
// Version 2.0
// Works with JDK 1.0 beta2.
// Patrick Taylor (taylor@us.net)
// Based on Daniel Wyszynski's NervousText applet from the JDK 1.0 beta1.
// See accompanying HTML documentation for detailed information.
// Requires CrazyLabel class.
import java.awt.Font;
import java.awt.Event;
import java.awt.Dimension;
import java.awt.BorderLayout;
public class CrazyText extends java.applet.Applet {
//JAVADRAW Wizard.Cut.Start
String AText = "SFS Software";
Font AFont = new Font ("TimesRoman", Font.PLAIN, 10);
int ADelay = 10;
int Delta = 10;
//JAVADRAW Wizard.Cut.End
protected CrazyLabel label;
protected static String[][] paramInfo = {
{"hgap", "int", "horizontal spacing between chars"},
{"hspace", "int", "extra spacing on left and right"},
{"vspace", "int", "extra spacing on top and bottom"},
{"clear", "boolean", "clear background on update"},
{"cycle", "string", "color changes: whole|char|none"},
};
public String[][] getParameterInfo() {
return paramInfo;
}
protected String getParam(String name, String defaultVal) {
String val = getParameter(name);
return (val == null) ? defaultVal : val;
}
public void init() {
// create and configure label
label = new CrazyLabel(AText);
label.setDelay(ADelay);
label.setDelta(ADelta);
label.setHgap(0);
label.setHspace(0);
label.setVspace(0);
label.setClear(getParam("clear","false").equals("true"));
label.setCycle(getParam("cycle","whole"));
label.setFont(AFont);
// add label to applet container
setLayout(new BorderLayout());
add("Center", label);
// this doesn't work now, but it might someday
resize(minimumSize());
}
public void start() {
label.start();
}
public void stop() {
label.stop();
}
}