I have an
applet set up that specifies a parameter called bgcolor which is set up to receive an rgb value (255,34,127). What I want to do is if any of the numbers is not specified I want to replace it with a 0. But it doesn't seem to be working. In my html, I specified the parameter as "255,,34" but when I print out the values of my final array in my applet, it prints out 255,34,0 instead of 255,0,34. Can someone point out what I'm doing wrong in my method here? Thanks.
StringTokenizer bgColor = new StringTokenizer(getParameter("bgColor"),",");
for ( int i = 0; i < 3; i++ )
{
if ( bgColor.hasMoreTokens() )
background[i] = Integer.parseInt(bgColor.nextToken());
else
background[i] = 0;
}
setBackground(new Color(background[0],background[1],background[2]));