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 t开发者_如何学运维he 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?
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.
精彩评论