• Post Reply Bookmark Topic Watch Topic
  • New Topic

Funny ImageIcon loading  RSS feed

 
Sandra Stone
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there, can someone help me with this..?
I have an application that loads a jpg "img.jpg" that resides in folder called "ImgFolder".
The application itself is in another folder called "classes". "ImgFolder" and "classes" both have the same parent folder, called "MyFolder".

.../.../MyFolder/ImgFolder/img.jpg

.../.../MyFolder/classes/MyApplication.class

The application contains code like this:

JButton imageBut = new JButton();
imageBut.setIcon(new ImageIcon( " //.../.../MyFolder/ImgFolder/img.jpg " ));

The strange thing is that when i run the application, the image is displayed ok, but the jpg is also copied to the "classes" directory! That is, a new folder calles "ImgFolder" is created within the classes directory, like this: MyFolder/classes/ImgFolder/, and the jpg is copied to this new folder!

Why does this happen? I don't want the jpg to be copied, or any new folder to be created... so what's happening?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used your folder structure and successfully loaded the image for all four JLabels in the code below. I did not experience any copying of folders or image file.
 
Sandra Stone
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No... the problem actually occured because of the settings in my JBuilder environment... i found out later. So it had nothing to do with ImageIcon. But thanks for answering, anyway! :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!