This site requires JavaScript, please enable it in your browser!
Greenfoot back
jay4221
jay4221 wrote ...

2020/3/18

SetImage problems

jay4221 jay4221

2020/3/18

#
I'm trying to use the setImage method but I keep getting an error saying that It can not find that symbol. I have another project that uses the same thing and it works so I'm not sure where I went wrong. I'm getting the error on the last line.
public void displayTemp()
    {
        GreenfootImage displayImage;
        displayImage = new GreenfootImage( Integer.toString(tempValue()), 20, Color.BLACK, Color.ORANGE);
        
         //Add the image as the new image for this object
        setImage(displayImage);
    }
Super_Hippo Super_Hippo

2020/3/18

#
If you want to use that in a world subclass as the world background, then you need to use ‘setBackground’ instead of ‘setImage’.
jay4221 jay4221

2020/3/18

#
that doesn't get registered as a method either
Yehuda Yehuda

2020/3/19

#
Show all the code of the class.
You need to login to post a reply.