Ok. I have struggled for weeks and tried every possible tutorial --but within netbeans 18, the coding will not set a series of images (slide format) within the jLabel1. My next and previous buttons do set the correct location and image but the jLabel1.setIcon(icon) doesn't work. I can system print the "icon" and it gives me the image file with its location. Just will not set the jLabel1 with that icon image. Any advice would be greatly appreciated. Below is the code I'm using. You can substitute the images.
Nothing wrong with OPs code, even though you may not like it.
The only problem was (at least on my windows machine) that that user.dir thing gives a string with double backslashes. Adding the rest of the path with forwardslashes does not work. It takes a simple action to correct this.
There are three kinds of actuaries: those who can count, and those who can't.