简体   繁体   English

为Java应用程序创建启动画面的最佳方法?

[英]Best way to create splash screen for a Java application?

I have a Java application that is designed to run on both Windows and OSX. 我有一个Java应用程序,可以在Windows和OSX上运行。 In some cases it might take a while to load because it basically looks at the directories inside the main directories (so two levels of directories). 在某些情况下,加载可能需要一段时间,因为它基本上会查看主目录中的目录(因此有两级目录)。 When it is done the main GUI will be shown, unless there are any errors, in which case a JOptionPane will appear. 完成后,将显示主GUI,除非有任何错误,在这种情况下将出现JOptionPane。

I would like to show a splash screen until either of the GUI or a message is displayed, however I'm not sure what the best way to do this is. 我希望显示一个启动画面,直到显示GUI或消息,但是我不确定最好的方法是什么。 Also, I'm not sure how to create the splash screen to start with - is there a program that people use? 此外,我不知道如何创建启动画面 - 是否有人们使用的程序?

If you are talking about a Swing application, then there is a Java Tutorial on this subject: 如果您正在讨论Swing应用程序,那么有关于此主题的Java教程:

For JNLP launched Swing applications, this blog covers changing the JNLP splash screen: 对于JNLP推出的Swing应用程序,本博客介绍了如何更改JNLP启动画面:

I couldn't find a tutorial for SWT applications, but here are a couple of examples: 我找不到SWT应用程序的教程,但这里有几个例子:


If you are asking about how to create the graphics / images for your splash screen, there are many tools out there for creating images, and recommending one would be off-topic for Stack Overflow. 如果您正在询问如何为启动画面创建图形/图像,那么有很多工具可用于创建图像,并且推荐一个用于Stack Overflow的主题。

在应用程序启动时显示一个带有图像的JOptionPane,它是你的启动屏幕,同时触发一个线程来为你做负载,当它完成后用启动画面隐藏窗格并显示你的主UI

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

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