Show animated GIF

后端 未结 9 1754
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 05:38

How do you display an animated GIF in a Java application?

9条回答
  •  情书的邮戳
    2020-11-27 06:14

    Try this:

    // I suppose you have already set your JFrame 
    Icon imgIcon = new ImageIcon(this.getClass().getResource("ajax-loader.gif"));
    JLabel label = new JLabel(imgIcon);
    label.setBounds(668, 43, 46, 14); // for example, you can use your own values
    frame.getContentPane().add(label);
    

    Found on this tutorial on how to display animated gif in java

    Or live on youtube : https://youtu.be/_NEnhm9mgdE

提交回复
热议问题