View Single Post
  #2 (permalink)  
Old 12-25-2007, 12:37 AM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Directory problem.
Your problem lies here:
Code:
sdConfig8.setIcon(new javax.swing.ImageIcon("C:\\filepath\\mycangui\\off .gif"));
Firstly, not all directories are described by the backslash operator. To make your directory references independent of the operating system that you are running on, use File.seperator. Secondly, the image will not be loaded because it does not automatically exist on the other machine's hard drive at that location. (unless you put it there) It is safer to use file names that are relative to the directory of your application. For example:

Code:
ImageIcon icon = new ImageIcon("data" + File.seperator + "off .gif");
I assume that you intended the space in "off .gif".

Inside your application's directory folder, you could have another folder called "data" with the image in there.
__________________
If your ship has not come in yet then build a lighthouse.
Reply With Quote