I have a button that I have replaced with an image, on hovering I want the image to play an animated gif. I have added a mouse listener and entered the code for changing the image to the gif. The image changes to the gif; however the gif does not animate. I have had a look for previous answers on this site, there are few but none have been able to 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) {}
}