Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Java problem, help?

I got this compile error, I can't get around!

Main.java:135: cannot find symbol

symbol: method drawImage(java.lang.String,int,int,Main)

location: class java.awt.Graphics

g.drawImage (backimage, 0, 0, this);

^

1 error

What's wrong with my code?

Update:

lol i just realised what i did. instead of

Image backimage;

backimage = getImage(getCodeBase(),imgUrlStr);

i did

String backimage;

backimage = imgUrlStr;

thanks Silent for pointing out it was a string.

thanks to other ppl for their help

this question is closed.

2 Answers

Relevance
  • Silent
    Lv 7
    1 decade ago
    Favorite Answer

    You are trying to pass the Graphics.drawImage() method some parameters that are different from those it specifies. There are several overloaded versions of that method, but none of them take a String as the first argument; it's always an Image.

    Without seeing the code it's very difficult to say anything more. Your best course of action is probably to read up on the AWT API to learn how to use this method.

  • 1 decade ago

    umm, i don't know, i can't see your code.

Still have questions? Get your answers by asking now.