The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Java question by Kickstart 2002-12-27 16:27:44
I just started learning Java, and I'm having problems...any idea why this is not getting the parameter value from the HTML below?

Java code:

import java.awt.*;

public class RootApplet extends javax.swing.JApplet {
        int number;
        public void ini() {
                String parameter = getParameter("NUMBER");
                if (parameter != null)
                        number = Integer.parseInt(parameter);
        }

        public void paint(Graphics screen) {
                super.paint(screen);
                Graphics2D screen2D = (Graphics2D) screen;
                screen2D.drawString("The square root of " +
                     number + 
                     " is " + 
                     Math.sqrt(number), 5, 50);
        }
}
HTML code:
<applet code="RootApplet.class" height=100 width=300>
<param name="NUMBER" value=198>
</applet>

thanks!

[ Reply ]
  Make sure that's init and not ini by tunaman2002-12-27 16:34:06
    Looks like the prime suspect. (n/t) by NorthernCoder2002-12-27 16:54:37
    Yep! That did it. by Kickstart2002-12-27 17:42:04
  stab in the dark by wonga-bonga2002-12-27 16:36:24

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)