今天,我已经测试过使用java splashscreen选项显示gif。 它正在工作,但是......在闪屏的重复中,我的gif显示了一个奇怪的图形错误......
此错误仅出现在java应用程序中。
这是原来的gif:
代码
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时取消选中这个...:)
答案 0 :(得分:0)
显然这只是因为gif是隔行扫描的。从photoshop导出你的gif时只需取消选中...:)