简体   繁体   English

创建一个spashscreen,使其停留几秒钟

[英]creating a spashscreen and making it to stay for few seconds

I wanted a spashscreen to be shown, it should stay a few a seconds so the user can read the contents in splash screen. 我希望显示一个spashscreen,它应该停留几秒钟,以便用户可以读取初始屏幕中的内容。

  1. I have made all my .jar files into a single .jar file by adding the below code in build.xml, 通过在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"/> 

I am using netbeans. 我正在使用netbeans。 The jar file is created by right clicking on the build xml file, 通过右键单击构建xml文件创建jar文件,

Run Target -> Other Targets -> package-for-store 运行目标->其他目标->商店包装

Any clue how to build the splash screen and hold it for a few seconds? 有什么线索可以建立启动画面并保持几秒钟吗?

Thanks 谢谢

  1. Create your self a JWindow (it's already undecorated). 为您的自我创建一个JWindow (尚未装饰)。
  2. Pass to this window, the "main" class that needs to be loaded after the window is closed.. 传递到此窗口,关闭窗口后需要加载“主”类。
  3. Add what ever it is you want to display to. 添加您想要显示的内容。
  4. Use a javax.swing.Timer to "wait" a given period of time. 使用javax.swing.Timer来“等待”给定的时间。 When the timer triggers, close the window and use the "main" class reference to load the rest of the application. 当计时器触发时,关闭窗口并使用“ main”类引用来加载应用程序的其余部分。

Additional... 额外...

You could also take a look at How to Create a Splash Screen 您也可以看看如何创建启动画面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM