设计启动画面(java) [英] Designing a splash screen (java)

查看:781
本文介绍了设计启动画面(java)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个启动画面,可以显示当前加载过程的进度条,
很像netbeans启动画面,因为它显示

I want to design a splash screen that can show the current loading process with a progress bar, much like netbeans startup screen, as it shows

loading... modules, done!.... loading modules and so on 

并且加载完成后主应用程序出现。

and after the loading finished the main application comes up.

我读过许多与仅创建启动画面但没有一个地址相关的文章关于如何在启动画面上显示不同后台任务的进度。

I have read many articles that are related to only creating a splash screen but none of them addresses about How to display progress of different background tasks on a splash screen.

我如何实现这一目标?

我可以将javafx 2用于启动画面,而应用程序的其余部分使用java编写

Can I use javafx 2 for splash screen while the rest of the application is written using java

已解决!

我终于成功了。
我的错误是我正在更新任务线程中的GUI内容,因此我的任务线程被阻止,并且在GUI更新指令后无法执行下一条指令。现在我移动了那些更新GUI指令任务完成后,它的工作.....
感谢Jewelsea走正确的道路。

I finally managed it to work. My mistake was I was updating the GUI content in the Task Thread so My Task Thread was Blocked and could not execute the next instructions after the GUI update instructions.Now I shifted those Updating GUI instruction after Task Completion, and its working..... Thanks Jewelsea for the right path.

推荐答案

我创造了之前的独立JavaFX 2.0应用程序的启动页面示例

I created a splash page sample for a standalone JavaFX 2.0 application previously.

I更新了示例以演示通过启动页面上的进度条和进度文本监视加载进度。

I updated the sample to demonstrate monitoring of the load progress via a progress bar and progress text on the splash page.

要调整代码以监视应用程序的初始化进度,而不是将 ProgressBar 绑定到WebEngine的 loadWorker.workDone 属性,创建一个JavaFX Task ,并通过任务的任务的进度。 html#progressProperty> progressProperty messageProperty

To adapt the code to monitor the initialization progress of your application, rather than tying the ProgressBar to a WebEngine's loadWorker.workDone property, create a JavaFX Task which performs expensive initialization work, and monitor the progress of the Task via the Task's progressProperty and messageProperty.

这是基于任务方法的基于splash的示例的链接在前一段中概述。

Here is a link to a splash based sample based upon the Task approach outlined in the prior paragraph.

对于WebStart或浏览器嵌入式JavaFX应用程序,请使用preloader

For a WebStart or browser embedded JavaFX application, use a preloader as suggested by assylias.

这篇关于设计启动画面(java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆