Prova con questa Applet che ho modificato io: spero ti vada bene:
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.MemoryImageSource;
import java.net.MalformedURLException;
import java.net.URL;
/**
*
*
Title: Scrollami</p>
*
Description: Applet per lo scroller del testo
* Questa applet permetto lo scorrimento del testo in verticale e
* permette il raggiungimento di vari link specificati dalla pagina html
* in cui è inserita. Per comodità ho inserito dei colori di default fissi
* al testo ed ai link ma nulla vieta di poter dare la possibilità di
* poter scegliere questi colori dalla pagina html come dei veri e propri parametri</p>
*
Copyright: Copyright (c) 2003</p>
*
Company: Sys-Tec s.c.r.l</p>
* @author Vincenzo Ricca
* @version 1.0
*/
public class Scroller extends Applet implements Runnable, MouseListener,MouseMotionListener{
//Colore blu della systec
private Color systec = new Color(34,120,251);
protected boolean clicked;
protected Color color;
protected long downTime;
protected int manualPause;
protected int linkClick;
protected int specialBackground;
protected boolean special;
protected long startTime;
protected boolean link;
protected int MyWidth;
protected boolean paused;
protected Font fontArray3[];
protected boolean mouseexit;
protected int mousex;
protected int mousey;
protected int lastlined;
protected boolean once;
protected String sColor;
protected int tempInt;
protected boolean checkError;
protected String error;
protected int lines;
protected String lineArray[];
protected int sizeArray[];
protected Color colorArray[];
protected String linkArray[];
protected int pauseLineArray[];
protected String temp;
protected String fontArray[];
protected int styleArray[];
protected int lineOffsetArray[];
protected int lineDown;
protected Thread thread;
protected Image offscreen;
protected Graphics offscreeng;
protected int width;
protected int height;
protected Font f;
protected FontMetrics fm;
protected int fs;
protected int ypos;
protected int lineSpace;
protected int diff;
protected int startLines;
protected int pauseValue;
protected Color background;
protected int totLines;
protected int adjYpos;
protected boolean run;
protected String linkFrame;
protected int lineOffsetDefault;
protected Color linkColor;
protected String SColorArray[] = {
"black", "blue", "cyan", "darkGray", "gray", "green", "lightGray", "magenta", "orange", "pink",
"red", "white", "yellow"
};
protected Color ColorMap[];
protected String SStyleArray[] = {
"PLAIN", "ITALIC", "BOLD",
};
protected int StyleMap[] = {
0, 2, 1
};
protected String fontArray2[] = {
"Dialog", "TimesRoman", "Courier","Verdana"
};
protected int lineSelect;
protected int lastLink;
protected int lined;
protected long diffTime;
/**
* Costruttore dell'applet
*/
public Scroller() {
clicked = false;
special = false;
link = false;
paused = false;
mouseexit = true;
once = true;
sColor = "";
checkError = true;
error = "";
run = true;
linkFrame = "";
linkColor = systec;
ColorMap = (new Color[] {
Color.black, Color.blue, Color.cyan, Color.darkGray, Color.gray, Color.green, Color.lightGray, Color.magenta, Color.orange, Color.pink,
Color.red, Color.white, Color.yellow
});
lineSelect = -1;
lastLink = -1;
}
/**
* Iniziliziamo l'applet
*/
public void init() {
jbInit();
}
/**
* Inizializzazione dei componenti
*/
private void jbInit(){
super.init();
setLayout(null);
this.addNotify();
this.addMouseListener(this);
this.addMouseMotionListener(this);
lines = getNumber("numberOflines");
if(lines < 0){
return;
}
lineArray = new String[lines];
sizeArray = new int[lines];
colorArray = new Color[lines];
fontArray = new String[lines];
styleArray = new int[lines];
linkArray = new String[lines];
pauseLineArray = new int[lines];
lineOffsetArray = new int[lines];
fontArray3 = new Font[lines];
linkFrame = this.getParameter("linkFrame");
if(linkFrame == null || linkFrame.equals("")){
error = "error: linkFrame value=\"" + linkFrame + "\"";
return;
}
manualPause = getNumber("manualPause");
if(manualPause < 0){
manualPause = 0;
}
linkClick = getNumber("linkClick");
if(linkClick < 0){
linkClick = 1;
}
if(linkClick > 2){
linkClick = 2;
}
//impostiamo colore del link
color = Color.lightGray;
if(color == null){
return;
}
linkColor = color;
temp = getParameter("background");
if(temp == null){
error = "error: background value=\"null\"";
return;
}
tempInt = getSpecial();
if(tempInt < 0){
return;
}
if(tempInt > 0){
color = getColor("background");
if(color == null){
return;
}
background = color;
setBackground(background);
}else{
special = true;
}
lineSpace = getNumber("lineSpace");
if(lineSpace < 0){
return;
}
pauseValue = getNumber("scrollDelay");
if(pauseValue < 0){
return;
}
startLines = getSize().height;
totLines = lineSpace * lines;
height = getSize().height * 2 + totLines;
if(special){
Image offscreen2 = createImage(createBackground());
offscreen = createImage(getSize().width, height);
offscreeng = offscreen.getGraphics();
offscreeng.drawImage(offscreen2, 0, 0, this);
offscreeng = offscreen.getGraphics();
}else{
offscreen = createImage(getSize().width, height);
offscreeng = offscreen.getGraphics();
offscreeng.setColor(getBackground());
offscreeng.fillRect(0, 0, getSize().width, height);
}
for(int i = 0; i < lines; i++){
pauseLineArray[i] = getNumber("pauseValueDefault");
if(pauseLineArray[i] < 0){
return;
}
lineArray[i] = getParameter("lineDefault");
if(lineArray[i] == null){
lineArray[i] = "";
}
sizeArray[i] = getNumber("sizeDefault");
if(sizeArray[i] < 0){
return;
}
colorArray[i] = systec;
tempInt = getFont("fontDefault");
if(tempInt < 0){
return;
}
fontArray[i] = fontArray2[tempInt];
tempInt = getStyle("styleDefault");
if(tempInt < 0){
return;
}
styleArray[i] = StyleMap[tempInt];
linkArray[i] = getParameter("linkDefault");
if(linkArray[i] == null){
linkArray[i] = "";
}
int z = linkArray[i].compareTo("");
if(z != 0){
link = true;
}
lineOffsetArray[i] = getNumber("lineOffsetDefault");
if(lineOffsetArray[i] < 0){
lineOffsetArray[i] = 0;
}
}
for(int i = 0; i < lines; i++){
String slineOffset = "lineOffset" + Integer.toString(i + 1);
tempInt = getNumber(slineOffset);
if(tempInt >= 0){
lineOffsetArray[i] = tempInt;
}else if(tempInt < -1){
return;
}
String sPauseLine = "pauseValue" + Integer.toString(i + 1);
tempInt = getNumber(sPauseLine);
if(tempInt >= 0){
pauseLineArray[i] = tempInt;
}else if(tempInt < -1){
return;
}
String sline = "line" + Integer.toString(i + 1);
temp = getParameter(sline);
if(temp != null){
lineArray[i] = temp;
}
String sSize = "size" + Integer.toString(i + 1);
tempInt = getNumber(sSize);
if(tempInt >= 0){
sizeArray[i] = tempInt;
}else if(tempInt < -1){
return;
}
String sColor = "color" + Integer.toString(i + 1);
color = getColor(sColor);
if(color != null){
colorArray[i] = color;
}
String sFont = "font" + Integer.toString(i + 1);
tempInt = getFont(sFont);
if(tempInt >= 0){
fontArray[i] = fontArray2[tempInt];
}else if(tempInt < -1){
return;
}
String sStyle = "style" + Integer.toString(i + 1);
tempInt = getStyle(sStyle);
if(tempInt >= 0){
styleArray[i] = StyleMap[tempInt];
}
else if(tempInt < -1){
return;
}
String lline = "link" + Integer.toString(i + 1);
temp = getParameter(lline);
if(temp != null){
linkArray[i] = temp;
link = true;
}
fontArray3[i] = new Font(fontArray[i], styleArray[i], sizeArray[i]);
offscreeng.setFont(fontArray3[i]);
fm = offscreeng.getFontMetrics();
offscreeng.setColor(colorArray[i]);
offscreeng.drawString(lineArray[i], lineOffsetArray[i], startLines + lineSpace * (i + 1));
}
checkError = false;
MyWidth = getSize().width;
startTime = System.currentTimeMillis();
}
/**
* Metodo che restituisce in uscita informazioni riguardanti l'applet
* @return -Le informazioni
*/
public String getAppletInfo() {
return "Applet per lo scrolling del testo";
}
/**
* Metodo che trasforma il parametro in ingresso in un numero
* @param parm -parametro passato dal foglio html in base al quale si va a calcolare il numero
* @return -il numero ottenuto
*/
protected int getNumber(String parm){
int num = 0;
temp = this.getParameter(parm);
if(temp == null){
error = "error: " + parm + " value=\"" + temp + "\"";
return -1;
}try{
num = Integer.valueOf(temp).intValue();
}catch(NumberFormatException _ex){
error = "error: " + parm + " value=\"" + temp + "\"";
return -2;
}return num;
}
/**
* Metodo che si occupa del calcolo del colore dello sfondo
* @param parm -Parametro passatogli da html che specifica il colore dello sfondo
* @return -Il colore ottenuto
*/
protected Color getColor(String parm){
int red = 0;
int green = 0;
int blue = 0;
String sRed = "";
String sGreen = "";
String sBlue = "";
temp = this.getParameter(parm);
if(temp == null){
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
}
red = temp.indexOf(",");
if(red > 0){
sRed = temp.substring(0, red);
green = temp.indexOf(",", red + 1);
if(green < 0){
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
}
sGreen = temp.substring(red + 1, green);
sBlue = temp.substring(green + 1, temp.length());
try{
red = Integer.valueOf(sRed).intValue();
}catch(NumberFormatException _ex){
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
}try{
green = Integer.valueOf(sGreen).intValue();
}catch(NumberFormatException _ex){
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
}try{
blue = Integer.valueOf(sBlue).intValue();
}catch(NumberFormatException _ex){
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
}
if(red > 255 || green > 255 || blue > 255){
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
} else{
return new Color(red, green, blue);
}
}
for(int i = 0; i < SColorArray.length; i++){
int z = temp.compareTo(SColorArray[i]);
if(z == 0){
return ColorMap[i];
}
}
error = "error: " + parm + " value=\"" + temp + "\"";
return null;
}
Fine prima parte....

Rispondi quotando