java CheckerApplet 类的 init() 方法和私有的 parseSquareSize() 方法:
public
void
init
(){
String
squareSizeParam =
getParameter
("squareSize");
parseSquareSize
(squareSizeParam);
String
colorParam =
getParameter
("color");
Color
fg =
parseColor
(colorParam);
setBackground
(Color.black);
setForeground
(fg);
}
private
void
parseSquareSize
(String
param){
if
(param
== null)
return;
try
{
squareSize
= Integer.parseInt
(param);
}
catch
(Exception
e)
{
// 保留默认值
}
}