Anu
Anu

Reputation: 1423

Application.launch() issue in javaFX 2.0

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

Answers (1)

Sergey Grinev
Sergey Grinev

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

Related Questions