R
R
Riard Brugekaaim2015-07-20 08:54:56
Java
Riard Brugekaaim, 2015-07-20 08:54:56

How to launch an error window from another thread?

Alert alert = new Alert(Alert.AlertType.ERROR);
                alert.setTitle("...");
                alert.setHeaderText("...");
                alert.setContentText("...");
                alert.showAndWait();

I need to launch the standard error window from another thread. The system throws a "cannot run from another thread" exception.
I found information that this can be bypassed by wrapping the code in the Task class.
And indeed - the error does not pop up and the code inside is executed (at least println). Yes, but the window still does not appear. =(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Emin, 2015-07-20
@OLDRihard

Well, have you tried googling? The dude has a similar problem, look towards Platform.runLater(...);
stackoverflow.com/questions/22772379/updating-ui-f...

D
Danil Antoshkin, 2015-07-20
@TwerTrue

Know that Java is no longer a new language, and there are already answers to all problems that you just need to find

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question