Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

Image load error

Thread view: 
mcampo84@gmail.com - 08 Aug 2006 16:16 GMT
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
mcampo84@gmail.com - 08 Aug 2006 16:53 GMT
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

> Hi all,
>
[quoted text clipped - 25 lines]
>
> -mc


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.