我的 java 应用程序的动态启动屏幕
我想为我的 Java 应用程序创建一个启动屏幕。我设法使用 NetBeans 默认工具来做到这一点,该工具允许我放入一些图像。但我希望那里有一些“实时”的东西,例如显示应用程序加载状态的进度条、一些动态文本等。
如何做我做这个?要开始做这样的事情我需要知道哪些事情?
I want to create a splash screen for my Java application. I managed to do this using the NetBeans default tool that allows me to put some image in. But i want to have something "live" there, such as a progress bar showing the status of application load, some dynamic text, etc.
How do I do this? What are the things I need to know to start doing something like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 Java 教程,将引导您完成您想要做的事情。您可以在命令行上设置图像,以便它立即显示,然后您可以在 JVM 初始化后操作它以添加文本、进度条等。
http://download.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html
Here is the Java tutorial walking you through exactly what you want to do. You can set the image on the command line so that it shows immediately, then you can manipulate it once the JVM is initialized to add text, progress bars, etc.
http://download.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html
诀窍是使用 swing 创建启动屏幕,然后使用 Java 反射调用加载应用程序的方法(该方法位于另一个 .java 文件中)。加载完成后,处理您的启动屏幕。
检查代码后,您将了解它是如何工作的,现在可以按照自己的方式自定义它。
这是一些代码:
The trick is to create a splash screen using swing and then invoke using Java reflection the method, which is in another .java file, that loades the application. When done loading, dispose your splash screen.
After checking the code, you will understand how it works and now customize it your own way.
Here is some code: