JLabel特定的GIF动画播放速度太快

Hoo*_*lum 5 java animation swing jlabel animated-gif

这个特定的GIF动画播放速度太快,比正常速度快100倍.有没有解决这个问题?或者我应该进一步减慢"GIF的正常速度"?

public class Test {

    private static final String url = "http://i.stack.imgur.com/AnrWw.gif";

    private void display() throws MalformedURLException {
        JFrame f = new JFrame("Test");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add(new JLabel(new ImageIcon(new URL(url))));
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    new Test().display();
                } catch (MalformedURLException ex) {
                    ex.printStackTrace(System.err);
                }
            }
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 0

我尝试使用其他动画 gif 图像,效果很好,问题可能是你的 gif 图像,尝试减慢 gif 的帧速率或降低质量。