This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer (Exam 1Z0-830) Java SE 17 Developer (Exam 1Z0-829) Programmer’s Guide and have Khalid Mughal and Vasily Strelnikov on-line!
See this thread for details.
  • 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
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Images in a Jar File

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using Forte for development. In my gui I use getImage("com/teoco/EitParser/eplogo.gif") to load the image in my title bar rather than the Java logo. This works.
Now I create a jar of all of the class files and this logo. Then I create a cmd file that launches the gui, but the image doesn't appear in the title bar anymore. After creating the bar, the gui can't seem to find the gif. Any ideas as to why???
Thanks in advance.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also have a same problem but the image is not on the on the title bar but used as splash screen. But if i provide the image in the correcct path outside the jar file it works perfectly.
What can i say is that it is due to the slow loading of images?
Anyone else with a better answer will be welcomed....
Jahanzeb Sayal
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keep the jar file in the classpath and try this code

frame.setIcon(new ImageIcon(getClass().getResource("/dir1/dir2/gif.gif"))
hope this works
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic