• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hidden variables in an applet

 
stephen buck
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am fairly new to the java seen howver i am trying to retrieve a hidden variable from a html doc through my java applet which is fired into the html doc.

i can assign an image path and the image displays in the applet no problem but when i declare it as a variable it wont let me carryan image variable across.

i have since altered it and am trying to caryy a string variable and then through a series of if statements assign the image path to the variable that has been carried over but this does obviuosly meen i have to carry each image option as a seperate variable name through the code.



however i keep getting the same error saying that they are incompatible types please help!!


public class scribble4 extends Applet implements ImageObserver
{

//declaration of variables

protected Image main;
protected Image frim;
private String rim1 = getParameter(String rim1);


public void init()
{

// get the images
main = getImage(getDocumentBase(), "r34main.jpeg");
frim = getImage(getDocumentBase(), "images/oxigin_1.jpg");
rim1 = getImage(getDocumentBase(), "images/avalini_blade.jpg");
 
Emmy Rauch
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your problem line is probably

private String rim1 = getParameter(String rim1);

In your html doc you should have something such as this:


Then in your class you should do

The key difference is that you are using sending it a String with the value "rim1" instead of just a variable named rim1.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic