i've been smashing head javafx...
this works when there's no instances of application running:
public class runner { public static void main(string[] args) { anotherapp app = new anotherapp(); new thread(app).start(); } } public class anotherapp extends application implements runnable { @override public void start(stage stage) { } @override public void run(){ launch(); } }
but if new thread(app).start()
within application exception stating can't 2 launches.
also method called observer on other application this:
@override public void update(observable o, object arg) { // new anotherapp().start(new stage()); /* not on fx application thread; exception */ // new thread(new anotherapp()).start(); /* java.lang.illegalstateexception: application launch must not called more once */ }
it's within javafx class such this:
public class runner extends applications implements observer { public static void main(string[] args) { launch(args); } @override public void start(stage stage){ //...code...// } //...methods..// //...methods..// @override public void update(observable o, object arg) { //the code posted above// } }
i tried using objectproperties listeners didn't work. need new stage running within update method java.util.observer in way.
any suggestions welcomed. thanks.
application not window -- it's process
. 1 application#launch()
allowed per vm.
if want have new window -- create stage
.
if want reuse anotherapp
class, wrap in platform.runlater()
@override public void update(observable o, object arg) { platform.runlater(new runnable() { public void run() { new anotherapp().start(new stage()); } }); }
Comments
Post a Comment