i need to Pass in three integers corresponding to an RGB value and use the appropriate Color constructor to set the background color.
import java.applet.*;
import java.awt.*;
public class AnAppletSubclass2b extends Applet {
int r;
int g;
int b;
//Color color = new Color (r,g,b);
public void init()
{
String parmStringRED = getParameter("red");
r = Integer.parseInt(parmStringRED);
String parmStringGREEN = getParameter("green");
g = Integer.parseInt(parmStringGREEN);
String parmStringBLUE = getParameter("blue");
b = Integer.parseInt(parmStringBLUE);
Color color = new Color (r,g,b);
System.err.println("The parameter are: red: " + parmStringRED + ", green: " + parmStringGREEN + ", blue: " + parmStringBLUE);
setBackground(color);
}
public void paint(Graphics g) {
System.out.println("In paint: n = " + n);
n++;
}
int n;
}
<HTML>
<HEAD>
<TITLE> AnApplet With Parms </TITLE>
</HEAD>
<BODY>
<p>Here is the output of my Program:</p>
<APPLET CODE="AnAppletSubclass2b.class" WIDTH=150 HEIGHT=100>
<PARAM name="red" value="25" >
<PARAM name="green" value="250">
<PARAM name="blue" value="250">
</APPLET>
</BODY>
</HTML>