I'm following this tutorial for java swing games: http://zetcode.com/tutorials/javagamestutorial/movingsprites/
At this point:
ImageIcon ii = new ImageIcon(this.getClass().getResource());
image = ii.getImage();
I just don't know what kind of path I have to write and where should I save my images (which directory).
Would you help me please? Would you give an example?
Read the Swing tutorial on How to Use Icons for examples of loading images as a resource file:
there is a mistake already in your code
you already name the ImageIcon ii, so you need to name the Image now may be iii then, you create a image directory in the src, and you put your pic there, like sample.png, the code will be
This means that the image is present in the directory where the underlying class file is existing. So, you should save your image in the same directory where the class file of current java file will reside.
In your src folder, create a folder called "images" or "files" then put the image in there.
Then use this:
If that doesn't work, try this: