Still Problem with displaying picture

Last thread I have posted about a problem of dispalying an image in jframe
Actully the file name is absolutely correct and the Image is in the same directory in which the prgrame file is palced.There is some other problem
Please Please tell me what other reasons are that image is not displaying
Thanks
Danish

Comments

  • : Last thread I have posted about a problem of dispalying an image in
    : jframe
    : Actully the file name is absolutely correct and the Image is in the
    : same directory in which the prgrame file is palced.There is some
    : other problem
    : Please Please tell me what other reasons are that image is not
    : displaying
    : Thanks
    : Danish
    :
    The current directory of the .class file might not be the diectory where the JVM looks. Try using an absolute path like this:
    [code]
    ImageIcon icon = new ImageIcon("c:\myimages\icon1.jpg");
    [/code]
    This way you absolutely know where the JVM looks for your image.

    PS: For the next time it is useful to reply to my reply. That way the thread becomes a conversation, which others with the same problem can follow.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion