我正在尝试制作加载屏幕。我创建了一个新的JFrame来保存它,但是gif没有动画。我该如何解决这个问题?
public class loadingFrame extends JFrame {
public int FRAME_WIDTH = 500;
public int FRAME_HEIGHT = 500;
private JPanel gifPanel;
public loadingFrame() {
setSize(FRAME_WIDTH, FRAME_HEIGHT);
createLoadingScreen();
addGIF();
}
public void createLoadingScreen() {
gifPanel = new JPanel();
add(gifPanel);
}
public void addGIF() {
ImageIcon imageIcon = new ImageIcon(loadingFrame.this.getClass().getResource("loading.gif"));
JLabel progress = new JLabel(imageIcon);
gifPanel.add(progress);
}
}