StringTokenizer st = new StringTokenizer(s, ",");
tickertext = st.nextToken();
tickercolor = Color.black;
speed = 100;
String fontname = "TimesRoman";
if (st.hasMoreTokens()) {
fontname = st.nextToken();
if (st.hasMoreTokens()) {
String str = st.nextToken();
if (str.startsWith("#")) {
str = str.substring(1);
}
try {
int colorval = Integer.parseInt(str, 16);
tickercolor = new Color((colorval >> 16) & 0xff,
(colorval >> 8) & 0xff,
(colorval >> 0) & 0xff);
} catch (Exception e) {
tickercolor = Color.black;
}
if (st.hasMoreTokens()) {
str = st.nextToken();
try {
speed = Integer.parseInt(str);
} catch (Exception e) {
speed = 100;
}
}
}
}
FontMetrics fm;
int size;
int nextsize = H;
do {
size = nextsize;
tickerfont = new Font(fontname, Font.PLAIN, size);
fm = parent.getFontMetrics(tickerfont);
nextsize = (size * 9) / 10;
} while (fm.getHeight() > H && size > 0);
tickerlen = fm.stringWidth(tickertext);
tickery = fm.getAscent();