tags:

views:

42

answers:

1
+1  Q: 

Images in Eclipse

I am creating a Scala Project in Eclipse. It is just a simple Swing application. I tried to load an icon for my Frame window.

iconImage = java.awt.Toolkit.getDefaultToolkit.getImage(resourceFromClassloader("icon.png"))

I know there are src and bin folders in the project folder I created. I managed to load the icon.png if I put it in the bin folder. I am wondering if there a way to put it in the src folder and have Eclipse to copy it into bin folder when the project is built?

Also, if I were to put the icon.png inside a folder named images inside src, is there a way to load it automatically into the bin folder as well?

+1  A: 

I can only speak for Java in Eclipse, but when I put icons into the src folder they will be automatically copied to the bin folder at compile time. For Java, there is a filter setting at Window - Preferences - Java - Compiler - Building. Maybe you have it set to filter png images.

nokul
That doesn't really work. I pasted a file into src folder, build project but it only stays there.
JohanSJA
I am sorry, nokul. But it seems to work now. When I clicked on the Project Main Node and refresh it, I am able to build it successfully.
JohanSJA