Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Image load error

Reply
Thread Tools

Image load error

 
 
mcampo84@gmail.com
Guest
Posts: n/a
 
      08-08-2006
Hi all,

I'm currently trying to convert a java application based on Piccolo
(http://www.cs.umd.edu/hcil/piccolo/) to an applet - it's pretty much a
family tree that shows pictures along with the names. I had it running
fine as a standalone application, but the imbedded applet conversion is
giving me a few problems. Originally, I was creating some PImage nodes
with the PImage(String) constructor and that was working fine. With
the applet, however, I've had to move the image files to a folder I
named "images" and included it in the src folder that NetBeans provides
me - so now the images are wrapped up in the jar. I modified my code
so that it looks like this:

private final ClassLoader cl = getClass().getClassLoader();
private final String PERSON_ICON = String.valueOf(
cl.etResource( "images/person.gif"));
private final Image PERSON_IMAGE =
Toolkit.getDefaultToolkit().getImage(PERSON_ICON);
.
.
.
entityImage = new PImage(PERSON_IMAGE);

The program runs, but I get an error message that says "media tracker
errored image load" for every node I try to create.

Any suggestions?

-mc

 
Reply With Quote
 
 
 
 
mcampo84@gmail.com
Guest
Posts: n/a
 
      08-08-2006
With enough time spent thinking that no one will help you, a solution
presents itself! I wound up getting it to work, so for all those out
there who might have the same problem, there is the correct code:

private final ClassLoader cl = getClass().getClassLoader();
private final String PERSON_ICON = "images/person.gif";
private final Image PERSON_IMAGE =
Toolkit.getDefaultToolkit().getImage(
cl.getResource(PERSON_ICON));
.
.
.
entityImage = new PImage(PERSON_IMAGE);

-mc

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi all,
>
> I'm currently trying to convert a java application based on Piccolo
> (http://www.cs.umd.edu/hcil/piccolo/) to an applet - it's pretty much a
> family tree that shows pictures along with the names. I had it running
> fine as a standalone application, but the imbedded applet conversion is
> giving me a few problems. Originally, I was creating some PImage nodes
> with the PImage(String) constructor and that was working fine. With
> the applet, however, I've had to move the image files to a folder I
> named "images" and included it in the src folder that NetBeans provides
> me - so now the images are wrapped up in the jar. I modified my code
> so that it looks like this:
>
> private final ClassLoader cl = getClass().getClassLoader();
> private final String PERSON_ICON = String.valueOf(
> cl.etResource( "images/person.gif"));
> private final Image PERSON_IMAGE =
> Toolkit.getDefaultToolkit().getImage(PERSON_ICON);
> .
> .
> .
> entityImage = new PImage(PERSON_IMAGE);
>
> The program runs, but I get an error message that says "media tracker
> errored image load" for every node I try to create.
>
> Any suggestions?
>
> -mc


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with design - reload image on image load; avoid infinite loop lawpoop Javascript 17 06-22-2009 06:59 PM
Load Balancing / Load Sharing over parallel paths ciscortp@hotmail.com Cisco 1 11-21-2005 03:57 PM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM
beginning page load immediately on postback with a long load time ? Mad Scientist Jr ASP .Net 7 06-30-2004 07:40 PM
[image] Optimize image load Blaise Java 3 10-07-2003 08:01 AM



Advertisments