[英]animated .GIF and Java
在小程序内显示动画.gif的代码是什么?
Just use an ImageIcon
and put it into a JLabel
, eg 只需使用
ImageIcon
并将其放入JLabel
,例如
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);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.