Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HELP: getImage(url) stopped working (was okay)?

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all.
I've been using this piece of code successfully, with only minor variations.
Basically an applet passes two parameters of type (URL, string) to a helper class.
Then on this particular variation of the code, I got this error:

and here is the code snippet for it

Why is this so?
Any hints and pointers appreciated.
TIA :-)
 
saager mhatre
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strangely enough, I don't see a method in either of your classes.
In what context did you use the method before? Did you define it any of your other classes? If yes, you might need to qualify the method call as you seem to have moved out of context!
If you are expecting an API method,
As evident from the JDK API docs, only one method with this signature exists and that is . Were you working on Applets previously, 'cause you've moved to a JFrame now!
You might want to consider other techniques now such as

...OR...
Using a dummy Applet member in your Frame to retrieve Images instances (though this approach could run aground if the platforms AppletContext doesn't support creating Images from an Orphan Applet!).
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank-you very much for your advice and taking time to look at my issue.
Yes, I was working with applets. I got the url in the startup applet (the one extending JApplet) and passed the url on as parameters to other applets (those not extending JApplet).
It is the first time I hear about the potential issue with "orphaned applets", and I am not convinced that one cannot access one's own image files in this manner. There might be legitimate reasons for it, but from where I see it, it seems over done.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic