• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about applet class

 
jin Otanashi
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here code for the applet class


here my question:

Find the getParameter method
is the value in the applet?
What does the related getParameterInfo method do?
change the color ?
The Integer wrapper class
What package is it in ( applet) ? is the AnAppletWithParms?

Find the parseInt method
Is in the object for the java class?
What are the other wrapper classes analogous to Integer for other types



 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets are invoked as client-side applications running under a user's local JVM. The classes themselves are downloaded from the same server that the webpage that specified the applet (due to sandbox restrictions).

The applet parameters (if any) are sub-elements of the object tag on the webpage that defined the applet. The applet can then use the getParameter method to obtain their values. What the applet does with parameter values is the applet's decision.

Your code example does not include a "package" statement, which means that the applet class is defined in Java's default package (which isn't recommended, incidentally).

What don't you understand about the Integer wrapper class? It's one of the core Java classes that comes as part of the JVM.
 
jin Otanashi
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Applets are invoked as client-side applications running under a user's local JVM. The classes themselves are downloaded from the same server that the webpage that specified the applet (due to sandbox restrictions).

The applet parameters (if any) are sub-elements of the object tag on the webpage that defined the applet. The applet can then use the getParameter method to obtain their values. What the applet does with parameter values is the applet's decision.

Your code example does not include a "package" statement, which means that the applet class is defined in Java's default package (which isn't recommended, incidentally).

What don't you understand about the Integer wrapper class? It's one of the core Java classes that comes as part of the JVM.


thank you so much by the way, what is this mean

8) n = Integer.parseInt(parmString);
he single parameter: null
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at AnAppletWithParms.init(AnAppletWithParms.java:8)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
do i need created or find the JVM?
 
Paul Clapham
Sheriff
Posts: 21583
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that the variable "parmString" is null and therefore can't be parsed into an integer value. Which, based on your code, means that the HTML from which the applet is run doesn't have an applet parameter named "number".
 
jin Otanashi
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:It means that the variable "parmString" is null and therefore can't be parsed into an integer value. Which, based on your code, means that the HTML from which the applet is run doesn't have an applet parameter named "number".

I see,so i need a "number" for the parameter
meaning i need to add a number like 1 or 0 for the applet parameter?
 
Paul Clapham
Sheriff
Posts: 21583
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not exactly. Your question implies you already have an applet parameter in your HTML. If you do, then apparently it isn't named "number". To make your code run you need an applet parameter named "number". And yes, its value does have to be an integer value, since you have code which assumes it is.
 
jin Otanashi
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Not exactly. Your question implies you already have an applet parameter in your HTML. If you do, then apparently it isn't named "number". To make your code run you need an applet parameter named "number". And yes, its value does have to be an integer value, since you have code which assumes it is.

Ok isn't inside the java file rather the HTML File.

this what found on the html:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic