I have a button that I replaced with an image, when I freeze I want the image to play an animated gif. I added a mouse listener and entered the code to change the image in the gif. The image changes to gif; however gif does not revive. I looked at the previous answers on this site, there are few of them, but no one could help.
@Override public void mouseEntered(MouseEvent arg0) { try { Image img = ImageIO.read(getClass().getResource("images\\button_1_hover.gif")); btnShip1.setIcon(new ImageIcon(img)); } catch (IOException ex) {} }
source share