aspose file tools*
The moose likes Beginning Java and the fly likes Help with my logo Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with my logo" Watch "Help with my logo" New topic
Author

Help with my logo

felix ortega
Greenhorn

Joined: Dec 24, 2009
Posts: 3
hopefully someone can help me. My program compiles fine but I get the error:
Uncaught error fetching image:java.lang.NullPointerException at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:99) at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:113) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:240) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)

i know the problem seems to lie within the attempt to create the company logo and there is an issue with it not knowing where to look for my logo. all of my attempts to fix it have been unsuccessful. i have to to turn this in today within the next 8 hrs and would appreciate any and all help. this is my last resort i dont know what to do or how to fix it.please keep in mind i am totally new to java programming.please please please please help me.

here are the assignment details:
•Modify the Inventory Program by adding a button to the GUI that allows the user to move to the first item, the previous item, the next item, and the last item in the inventory. If the first item is displayed and the user clicks on the Previous button, the last item should display. If the last item is displayed and the user clicks on the Next button, the first item should display.
•Add a company logo to the GUI using Java graphics classes.


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Check this FAQ.


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16


If the logo is not found, the url will be null. Where did you put it ?
felix ortega
Greenhorn

Joined: Dec 24, 2009
Posts: 3
In regards to your first reply---gotcha and I wont let it happen again

In regards to your second post---this is where the file is on my computer:
C:\Users\Felix & Karen\Documents\School Folder\IT 215 Materials\logo.jpg

Is that what you meant?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Are you allowed to use a full path to load your image ? If you are, you can use the following instead :


this.getClass().getResource("logo.jpg"); is going to look for "logo.jpg" in a place accessible by the Inventory5i's classloader. If you had put "logo.jpg" in the same directory as the Inventory5i.class, it would have been found. There's a tutorial here.
felix ortega
Greenhorn

Joined: Dec 24, 2009
Posts: 3


Man you are the most awesome person ever!!! I do not know why for the life of me I could not get that to work no matter where I put the logo.


I want to thank you one hundred billion times again and again.

I guess i'm just so tired of this project I couldn't see the problem.

Cheers to you!!!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with my logo