I am experiencing a strange problem in that I can't seem to get the
parameters I am passing to my applet to be recognized correctly.  I have
written a small sample program from one of my texts and still receive the
problem... when I run the following code I would expect to see "Hello
Bonzo!" but am instead seeing "Hello name!"...  I imagine that I have some
small coding mistake that I can't see... can anyone identify it?  
 
HTML Source:
 
<HTML>
<HEAD>
<TITLE>Hello</TITLE>
</HEAD>
<BODY>
<BR><APPLET CODE="HelloApplet.class" CODEBASE="Java" HEIGHT=200 WIDTH=500)
<PARAM NAME="name" VALUE="Bonzo">
Hello to you!
</APPLET>
</BODY>
</HTML>
 
Java Source:
 
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
 
public class HelloApplet extends java.applet.Applet
{
    Font f = new Font("TimesRoman", Font.BOLD, 36);
    String name;
 
    public void init()
    {
        name = getParameter("name");
        if (name == null)
            name = "Smith";
 
            name = "Hello " + name + "!";
    }

    public void paint(Graphics g)
    {
        g.setFont(f);
        g.setColor(Color.red);
        g.drawString(name, 5, 40);
    }
}


 
 
Greg E. Roll


BT Office Products Intl.
Interface/Conversions Team
phone - (817) 323-1300 ext. 2921
e-mail  - [EMAIL PROTECTED] 

Tech Tools.gif

Reply via email to