在小程序内显示动画.gif的代码是什么?
Just use an ImageIcon
and put it into a JLabel
, eg
public class AnimatedGIF {
public static void main(final String[] args) throws MalformedURLException {
final URL location = new URL("http://upload.wikimedia.org/wikipedia/commons/archive/f/f0/20060824220301!Zipper_animated.gif");
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new JLabel(new ImageIcon(location)));
frame.pack();
frame.setVisible(true);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.