Image load error

Discussion in 'Java' started by mcampo84@gmail.com, Aug 8, 2006.

  1. Guest

    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
     
    , Aug 8, 2006
    #1
    1. Advertising

  2. Guest

    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

    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
     
    , Aug 8, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mad Scientist Jr
    Replies:
    7
    Views:
    1,170
    Emma Gumbdough
    Jun 30, 2004
  2. venky

    Page Load and webcontrol page load

    venky, Jul 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,108
    venky
    Jul 11, 2005
  3. Blaise

    [image] Optimize image load

    Blaise, Oct 6, 2003, in forum: Java
    Replies:
    3
    Views:
    677
    Blaise
    Oct 7, 2003
  4. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,362
    Kartic
    Jan 26, 2005
  5. lawpoop
    Replies:
    17
    Views:
    754
    Thomas 'PointedEars' Lahn
    Jun 22, 2009
Loading...

Share This Page