hi,there
I’m trying to change the display ICON. Problem is , It just doesn’t work, nothing is changed.
running system win10 64.
did i use right importing? (java.awt.image.BufferedImage and javax.imageio.ImageIO)
can anyone tell me what to do ?
thanks
I copied png files to d:/ and change code to ImageIO.read(new File(d://g1632.png")) then it works.
But why it can’t read ( “/Textures/g1632.png”) ? it is in the asset directory.
AssetKey key = new AssetKey("/Textures/g1616.png");
assetManager.loadAsset(key);
you are using the asset manager to access the PNG.
When you write
new File("/Textures/g1616.png");
you are using an absolute path in the local filesystem to access the PNG.
These are two very different mechanisms. While the asset manager can be configured to use the local filesystem, by default it uses the classpath. For typical projects, selected files in the project’s “assets” subdirectory are incorporated into the classpath so that they’re available no matter what computer the application is running on.
The IDE executes applications in the project directory, so as long as you’re in the IDE, something like this should work:
new File("./assets/Textures/g1616.png");
but this is likely to break if you run the application outside the IDE: in a different working directory, or an a different computer.
For portability, you probably want to access those PNG files as assets on the classpath, using the asset manager.