Reputation: 1423
In my code, I have used :
Application.launch(MyDesign.getClass(), null);
to run a UI of MyDesign from a seperate class.
When it calls launch()
, it executes the constructor of MyDesign
class. I have created a MyDesign
object earlier and initialized its attributes. So I got a new object after calling launch()
. I need to stop the calling its constructor when I call
Application.launch().
Your feed back is highly appreciated. Thanks.
Upvotes: 1
Views: 1199
Reputation: 34498
Unfortunately you can't directly run already created Application through Application.launch()
.
You can use next stub application and launch it instead:
public class Runner extends Application {
@Override
public void start(Stage stage) throws Exception {
myDesignInstance.start(stage);
}
}
Upvotes: 1