导出的Java程序初始屏幕未显示

时间:2015-02-01 20:53:37

标签: java eclipse-luna

所以我创建了一个简单的java程序(不重要),在eclipse中我有一个gif文件,它是启动画面。当我将程序导出到jar中时,启动画面显示为空白。对此有何帮助?提前致谢。这是主要的课程:

package com.ethan.main;


import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.SwingConstants;



public class SingAlong {

     public static void main (String args[]) {
         int close = 0;
         JWindow window1 = new JWindow();
         window1.getContentPane().add(
             new JLabel("", new ImageIcon("res/Backgrounds/Final GIF.gif"), SwingConstants.LEFT));
         window1.setBounds(0, 100, 300, 200);
         window1.setVisible(true);
         if(close == 1){
             window1.dispose();
         }

         try {
             Thread.sleep(6850);
             close = 1;
         } 
         catch (InterruptedException e) {
             e.printStackTrace();
         }


         JFrame window = new JFrame("Science Quiz");
            window.setContentPane(new SingAlongMain());
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            window.setResizable(true);
            window.pack();
            window.setVisible(true);


}
}

0 个答案:

没有答案