Applet Name: js.class Description: Parameters passed to applet from input taken through use of JavaScript. Inspect source code! |
import java.applet.*; import java.awt.*; public class js extends Applet { Font f = new Font("TimesRoman",Font.BOLD,12); String x,y,z; Dimension s; public void init() { x=getParameter("n"); y=getParameter("v"); z=getParameter("a"); s=size(); x="The "+z+" "+x+" is "+y+"."; y="Have you been "+y+" very long?"; z="Does your mother know about your "+z+" habit?"; } public void paint(Graphics g) { g.setFont(f); g.setColor(Color.green); g.fillRect(0,0,s.width,s.height); g.setColor(Color.black); g.drawString(x,10,50); g.drawString(y,10,110); g.drawString(z,10,170); } }