Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2015
    Posts
    2
    Rep Power
    0

    Default Why won't this JLabel show this Image Icon

    I have no idea why the label wont show the file. The file is located within the project.
    Attached Thumbnails Attached Thumbnails Why won't this JLabel show this Image Icon-screen-shot-2015-02-12-4.39.47-pm.png  

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Why won't this JLabel show this Image Icon

    Are you sure the path to the image file is correct? How do you know the program is looking where you expect it to look? Is the image being read?

    Try using the ImageIO class's read() method to read the image file. It will give an error if it does not find the file.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Why won't this JLabel show this Image Icon

    It would help if you would:

    1. Paste your actual code in the post (between [code][/code] tags.
    2. Include the other relevant code (like where you add the panel to the JFrame).

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    26

    Default Re: Why won't this JLabel show this Image Icon

    Quote Originally Posted by jim829 View Post
    It would help if you would:

    1. Paste your actual code in the post (between [code][/code] tags.
    2. Include the other relevant code (like where you add the panel to the JFrame).
    3. Make a habit of returning to threads you start.

    http://www.java-forums.org/new-java/...d-methods.html

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 2
    Last Post: 05-31-2014, 05:23 PM
  2. Last JLabel I add to JPanel doesnt show up
    By Ambergahill in forum New To Java
    Replies: 6
    Last Post: 01-29-2014, 08:07 PM
  3. wont show entire JLabel
    By Billaguana in forum AWT / Swing
    Replies: 6
    Last Post: 02-03-2011, 10:18 PM
  4. Replies: 2
    Last Post: 11-24-2010, 02:38 PM
  5. JLabel icon disappears
    By grease_monkey1986 in forum AWT / Swing
    Replies: 3
    Last Post: 05-09-2010, 12:43 PM

Tags for this Thread

Posting Permissions

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