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.
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.