×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    9

    3510i Image.createImage(String)

    HI
    public Pacman() {
    try {
    image[1] = Image.createImage("fish20.png");
    }
    catch (IOException ex) {
    System.out.println("no pic");
    }
    }
    I can't get any pic loaded, no mater where I put it? Like local Dir or on Image.createImage("C:/fish20.png");

    Can anyone help me???

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    15
    place the picture in the same directory as your class and call

    createImage with the name of the parent-folder where the class and the png are located in.

    Image var = Image.createImage("/parentfolder/picture.png");

    it works fine with me.

    Pay also attention to the Filename if it is .png or .PNG! Java makes a diffrence here!

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    9

    Working.... :o)

    Thanks!
    The problem whas that JBuilder was setup to only look tre step down in package.... (

    Now i'am up and running. Have a nice weekend

    bye bye
    -Jesper

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •