2013-02-05 31 views
0

我希望顯示一個spashscreen,它應該停留幾秒鐘,以便用戶可以讀取啓動畫面中的內容。創建一個spashscreen並讓它停留幾秒鐘

  1. 我已經通過添加build.xml文件下面的代碼讓我所有的.jar文件合併爲一個.jar文件,

    <!-- Change the value of this property to be the name of your JAR, 
        minus the .jar extension. It should not have spaces. 
        <property name="store.jar.name" value="MyJarName"/> 
    --> 
    <property name="store.jar.name" value="store"/> 
    
    
    <!-- don't edit below this line --> 
    
    <property name="store.dir" value="store"/> 
    <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/> 
    
    <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/> 
    
    <delete dir="${store.dir}"/> 
    <mkdir dir="${store.dir}"/> 
    
    <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip"> 
        <zipgroupfileset dir="dist" includes="*.jar"/> 
        <zipgroupfileset dir="dist/lib" includes="*.jar"/> 
    
        <manifest> 
         <attribute name="Main-Class" value="${main.class}"/> 
        </manifest> 
    </jar> 
    
    <zip destfile="${store.jar}"> 
        <zipfileset src="${store.dir}/temp_final.jar" 
        excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/> 
    </zip> 
    
    <delete file="${store.dir}/temp_final.jar"/> 
    

我我正在使用netbeans。該jar文件是通過在構建XML文件右擊創建,

運行目標 - >其他目標 - >包裝換店

任何線索如何建立閃屏,並保持幾秒鐘?

感謝

+0

我不使用NetBeans所以也許我失去了一些東西,但似乎沒有任何東西在這裏關於splashscreen。也許你需要包含你的'main.class'源代碼? – sharakan

+0

在清單標籤中爲您的啓動畫面添加信息: 有同樣的問題。 –

回答

1
  1. 創建你的自我JWindow(它已經未修飾)。
  2. 傳遞給此窗口,窗口關閉後需要加載的「主」類。
  3. 添加您想要顯示的內容。
  4. 使用javax.swing.Timer來「等待」給定的時間段。當計時器觸發時,關閉窗口並使用「main」類引用來加載應用程序的其餘部分。

附加...

你也可以看看How to Create a Splash Screen

+0

+1謝謝,我用jwindow – FirmView