ProgressTask, of an in a Swing embedded JavaFx application, starts late -


i´m embedding serveral javafx panels swing application, these running quite well. i´d add progressbar on starting plugin , here problem. progressbar appears late.

this class use embedding.

private progressindicator indicator; private stage stage; private scene scene; private borderpane root;  public fxioguiprogresstask() {     initgui();     startjfxprogresstask(); }  private void startjfxprogresstask() {      task task = new task<void>() {         @override         public void call() {             try {                 load();             } catch (exception ex) {                 logexception(ex);                 return null;             }             platform.runlater(() -> {                 try {                     finished();                     stage.close();                     afterfinishedinformation();                 } catch (exception ex) {                     logexception(ex);                 }             });             return null;         }     };     new thread(task).start(); }  protected abstract void load() throws exception;  protected abstract void finished() throws exception;  public void afterfinishedinformation() { }  private void initgui() {     platform.runlater(() -> {         indicator = new progressindicator();         indicator.setmaxsize(150, 150);         stage = new stage();         stage.settitle("wird geladen...");         stage.initstyle(stagestyle.transparent);         stage.initmodality(modality.application_modal);         root = new borderpane(indicator);         root.setstyle("-fx-background-color: transparent");         scene = new scene(root, color.transparent);         stage.setalwaysontop(true);         stage.setscene(scene);         stage.show();     }); } 

if move finished() method out of platform.runlater(), , place after load() method, exception occurs "not on fx application thread".

maybee knows answer.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -