wood burning stoves
The moose likes Applets and the fly likes hidden variables in an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "hidden variables in an applet" Watch "hidden variables in an applet" New topic

hidden variables in an applet

stephen buck

Joined: Apr 08, 2005
Posts: 1
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

Joined: Jul 07, 2004
Posts: 12
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: hidden variables in an applet
It's not a secret anymore!