• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Images are not showing up...

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a Java application using JBuilder. My directory structure is
the following(these are generic names):
ProjectFolder
bak
src
package
.java files
images
.jpg files
classes
package
.class files
This structure works fine in JBuilder and jpg images show as they should.
I am using the following code to add images to some JButtons:
ImageIcon("./images/*.jpg")
My problem is when I put the classes/package directory in a jar file. I am also putting the images directory in the same jar. The executable jar does not show the images on the executing program. What have I done wrong? I am using winzip to compress files; I am then changing the file extension to jar. The program executes fine, but without images on my JButtons.
Thanks for any help,
Jason
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use icon No. 4, you may add a code-block ([ code]) around your dir-structure, so that we see what you mean:

You may not just use "./images/foo.jpg", but

[ May 16, 2004: Message edited by: Stefan Wagner ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you can show ".jpg" images in file.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic