Animated GIF on a JButton, play it when mouse is hovered

前端 未结 2 1856
梦如初夏
梦如初夏 2020-12-18 06:27
Icon icon = new ImageIcon(getClass().getResource( \"/img/icon.gif\" ) );
aButton = new JButton(\"Its a button\", icon);

Is there some kind of metho

2条回答
  •  甜味超标
    2020-12-18 07:23

    button.setIcon(new ImageIcon("/*icon location*/"));
    button.setRolloverIcon(new ImageIcon("/*icon location*/"
    

    The Animated gif image will not get invisible when mouse pointer moves over the button.

提交回复
热议问题