In the old GUI builder, I would just press "next form" in the command. In the new GUI builder, I am trying to make it through code. However, it does not wait for 5 seconds, the app goes straight into the next form.
What I want to do: stay in Splash for 5 seconds, then go to the login form. How would that work?
My forms:
Splash.java, that has the GIF animation.
Login.java (next form)
Myapplication.java (main form)
Main file, myapplication code:
public void start() {
if(current != null){
current.show();
return;
}
new Splash().show();
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
}
new Login().show();
}
UPDATE: I added the sleep code to the LOGIN form, and every time i go there, it waits 5 seconds. Is this the optimal way to do this? public Login() {
this(com.codename1.ui.util.Resources.getGlobalResources());
try {
Thread.sleep(3000);
} catch (InterruptedException ex) {
}
UPDATE 2:
public void start() {
if(current != null){
current.show();
return;
}
new Splash().show();
// new login().show();
new UITimer(() -> {
new login().show();
}).schedule(3000, false, new login());
not working.
UITimersleep holds the EDT in place and doesn't let it draw or do anything (e.g. showing a Form) see codenameone.com/manual/edt.html - Shai Almog