There are applications in Java . In the application, an icon is generated and placed next to the application in the res folder (the icon name is always the same tray.png — that is, it is overwritten ). So when the application starts, it already has some kind of icon (for example, a black one ). This image is loaded and installed , then a new icon is generated (for example, green ), and set again to the icon, respectively, the icon should be replaced from black to green , but this does not happen (the icon is updated, but again to black, which is no longer in the resources basically).
I save the icons as follows:
ImageWriteEx ImageWriteEx = new ImageWriteEx(); BufferedImage bi = ImageWriteEx.createImageWithText(); File outputfile = new File("./res/tray.png"); ImageIO.write(bi, "png", outputfile); I load the icons like this:
Image image = Toolkit.getDefaultToolkit().getImage("./res/tray.png"); setIconImage(image); So, what's my problem?