Many learners have the problem of missing images from their Java JFrameForms when they move their PAT projects from one computer to another.
The reason for this is that the path to the image has been hard coded (see examples below)
In lines 81, 82 and 91 the image icon for the label has been hardcoded to the learners own D:\ drive on their laptop.
You can fix this problem by getting rid of path and leaving the image name only e.g. “background.jpg”. Without the path, Java will look in the current project folder.
How to do this?
Insert the label that you are going to use for your image. Stretch it to the correct size on the panel. Right click and go to the properties of the label and continue to the icon setting. Click on the elipsis and get an “External image”. Browse to the image location and then choose “Import to Project”. This will import the image into your project file. When you want to distribute your work (the jar file) it will include all the images needed by the project.