Java with Javafx

Asked

Viewed 22 times

2

People I’m trying to make a thread call when opening the customer registration screen, but my screen is not opening, someone can help??

    @FXML
    void OpenCliente(ActionEvent event) {
        try {
            //CREATING A THREAD
            Task<Void> ts = new Task<Void>() {
                @Override
                protected Void call() throws Exception{
                    ClienteExec cliente = new ClienteExec();
                    cliente.start(new Stage());
                    return  null;
                }
                @Override
                protected void succeeded(){
                    super.succeeded();
                }
            };
            new Thread(ts).start();
            }catch (Exception e) {
                e.printStackTrace();
        }
    }
  • You cannot manipulate interface elements using Task, you probably gave the error: Not on Fxapplication Thread

  • what method should I use to open a thread in a scene?

  • I couldn’t answer because it turned out to be a code without context, and you said what the problem was but not what the goal was. Why you have to open the clients screen using thread?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.