• 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:

Loading File from source?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, this is my first question on this forum!

My problem is that I want to load an Image from the source directory in Canavas' paint() method.
My code is currently (in a try/catch)

Where imageLocation leads to an image on my HDD ("C:\\Users\\Vladde\\Documents\\Folders-Files\\folder.png").


I've previously made a small program which loads images from the source dir without any problems, and the code is:


But when I tried putting in:

I get the exception: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!
The folder setup are the same, so I'm guessing the problem lies within the code.

All help is very appreciated. Thanks.
 
Ranch Hand
Posts: 250
1
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the problem is not in your code but in the placement of your image.

This is my current setup. The images folder is located in the same directory as my Java file.



Note that I had to use .class since I'm in a static method.
 
Marshal
Posts: 80642
472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic