如何在 Codename One 中暂停启动画面?
似乎示例(本机演示)使用 replaceAndWait(...) 方法,但在我的情况下,我没有什么可替换的,但我只想让屏幕等待几秒钟。
我尝试使用 Thread.wait(n) 但它崩溃了。
谢谢!
您可以在文件中调用UITimer
内部来延迟启动画面。processBackground()
StateMachine.java
如果您不使用StateMachine
(未在 GUI 生成器中创建 Splash),请通过UITimer
在可能驻留在主类中的飞溅操作方法中使用来延迟下一个表单的显示方式。
@Override
protected boolean processBackground(final Form f) {
//depends on your splash form's name
if ("Splash".equalsIgnoreCase(f.getName())) {
new UITimer(() -> {
//show your next form here
}).schedule(4000, false, f);// set the time to a longer time, currently 4 seconds
}
return false;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句