英文:
How to create loading screen for Java Swing?
问题
我有一个Java Swing程序,其中有许多组件,我想实现一个可以根据需要调用的等待动画(如果可以将所有内容都打包到一个方法调用中-不仅限于程序开始时)。我的想法是有两个图像,类似PowerPoint样式地滑入 -> 等待组件完成 -> 两个图像滑出。我计划在Java Swing中为这两个图像制作动画(通过随时间递增它们的x和y位置)。有任何关于如何实现的想法吗?我在考虑是否需要一个SwingWorker,但我对这方面不是很有经验。是否有可能知道Swing何时完成处理和绘制所有组件?谢谢。
英文:
I have a Java Swing program that has a lot of components and I want to implement a waiting animation that can be called on will (if it can be packaged all into one method call - not for just when the program begins). The idea is that I have two images that swoop in PowerPoint style --> wait for the components to be done --> the two images swoop out. I plan to do the animation for the two images in Java Swing (that is incrementing their x and y positions over time). Any ideas how I can go about this? I was thinking that I need a SwingWorker but I'm not very experienced with those. Is it even possible to know when Swing is done processing and painting all the components? Thank you.
专注分享java语言的经验与见解,让所有开发者获益!
评论