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

2013/12/9

Give Image Color

Sykesfaction Sykesfaction

2013/12/9

#
I am trying to give images color as background. I am having a hard time doing it i have tried set-color which didn't work. I have included the code below. /** * this method will create an drsesus image refrence */ public void drSesus() { setImage("cat_in_hat.jpg"); } /** * this image will show where mickey mouse live which is disney land. */ public void mickeyMouse() { setImage("disneyLights.jpg"); }
danpost danpost

2013/12/9

#
I do not see any 'setColor' method calls anywhere in the code you posted. How can we help?
Sykesfaction Sykesfaction

2013/12/9

#
This is what i am talking about. I'm trying to change the color when i call the image but when i call setColor it say it cant find the method. /** * this image will show where mickey mouse live which is disney land. */ public void mickeyMouse() { setImage("disneyLights.jpg"); setColor(20,0,0); }
danpost danpost

2013/12/9

#
The 'setColor' method has only one parameter and it must be of Color type. You are showing three 'int's for the parameters in your 'setColor' method call. You can create a new Color with those color part values with 'new Color(20, 0, 0)' (or 'new java.awt.Color(20, 0, 0)' if you do not 'import java.awt.Color;').
You need to login to post a reply.