Displaying Gif animation in java

前端 未结 4 864
野性不改
野性不改 2020-12-06 01:33

Hello I am writing a GUI application on Java 1.6 with Swing.

I have a pop up screen that should display a gif animation while my Swing gui is loading and also a litt

4条回答
  •  囚心锁ツ
    2020-12-06 02:19

    Inside your JFrame or whatever, use this :

    Icon imgIcon = new ImageIcon(this.getClass().getResource("ajax-loader.gif"));
    JLabel label = new JLabel(imgIcon);
    label.setBounds(669, 42, 45, 15); // You can use your own values
    frame.getContentPane().add(label);
    

    Source : How to display an animated gif in java swing

提交回复
热议问题