JDK 1.6.0 Applet Background Issue
Hello All,
I have a simple Java Applet which was working fine in JDK 1.4.x. Here is the code for it:
import java.awt.*;
import java.util.*;
publicclass NewWatchextends javax.swing.JApplet{
private Color white =new Color(0, 0, 0);
private String lastTime ="";
Color back;
publicvoid init(){
String in = getParameter("background");
back = Color.red;
if (in !=null){
try{
back = Color.decode(in);
}catch (NumberFormatException e){
showStatus("Bad parameter " + in);
}
}
setBackground(back);
}
publicvoid paint(Graphics screen){
Graphics2D screen2D = (Graphics2D)screen;
Font type =new Font("Monospaced", Font.BOLD, 12);
screen2D.setFont(type);
GregorianCalendar day =new GregorianCalendar();
String time = day.getTime().toString();
screen2D.setColor(back);
screen2D.drawString(lastTime, 5, 25);
screen2D.setColor(white);
screen2D.drawString(time, 5, 25);
try{
Thread.sleep(1000);
}catch (InterruptedException e){
// do nothing
}
lastTime = time;
repaint();
}
}
And here is the HTML page for it:
<applet code="NewWatch.class" height="40" width="205">
<param name="background" value="#FF000000">
This program requires a Java-enabled browser.
</applet>
You can see a working version of this applet here:
http://www.digioz.com/java.php
The problem is that since upgrading to JDK 1.6.0 this morning, I no longer see the background chosen through the parameter in the HTML code. Has anyone had a similar problem and/or know the solution to this issue?
Thanks,
Pete

