Java gif 启动画面奇怪的错误

Java gif splashscreen strange bug

今天,我测试了使用 java 闪屏选项显示 gif。 它工作正常,但是...在启动画面重复时,我的 gif 显示一个奇怪的图形错误...

此错误仅出现在 java 应用程序中。

这是原图:

密码

public class Bootstrap {
private SplashScreen splash;

public static void main(String[] args) {
    Bootstrap bootstrap = new Bootstrap();
    bootstrap.start();
}

public void start() {

    // Here i load the splash
    splash = new SplashScreen("UC", new ImageIcon(getClass().getResource("splash3.gif")).getImage());
    AWTUtilities.setWindowOpaque(splash, false);
    splash.setVisible(true);
}
}

SplashScreen.java

public class SplashScreen extends JFrame {
public SplashScreen(String title, Image image) {
    this.setTitle(title);
    this.setUndecorated(true);
    this.setDefaultCloseOperation(3);
    this.setSize(image.getWidth(this), image.getHeight(this));
    this.setLocationRelativeTo((Component)null);
    this.setContentPane(new SplashPanel(image));
}
}

Splashpanel.java

class SplashPanel extends JPanel {
private Image image;

public SplashPanel(Image image) {
    this.image = image;
}

public void paintComponent(Graphics g) {
    g.drawImage(this.image, 0, 0, this.getWidth(), this.getHeight(), this);
}
}

显然这只是因为 gif 是隔行扫描的。 :) 当您从 photoshop 导出 gif 时,只需取消选中此选项...:)

显然这只是因为 gif 是隔行扫描的。当您从 photoshop 导出 gif 时,只需取消选中此选项...:)