samedi 29 août 2015

JavaFX: how to test easy JavaFX Apps with Junit and netbeans

I am looking for a simple possibility to test little JavaFX Apps with JUnit and Netbeans. I tried without success to test with JUnit, but it is said that it is not possible to handle the Javafx application thread...

Is there another easy possibility to test Javafx Tools with a another easy tool just without programming??

I hope I do not ask silly questions ....

Here is a demo FX Code that I want to test

public class MyClass extends Application {

@Override
public void start(Stage primaryStage) {
    Button btn = new Button();
    btn.setText("Say 'Hello World'");
    btn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Hello World!");
        }
    });

    StackPane root = new StackPane();
    root.getChildren().add(btn);
    Scene scene = new Scene(root, 300, 250);
    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene);
    primaryStage.show();
}

public static void main(String[] args) {
    launch(args);
}

}

Aucun commentaire:

Enregistrer un commentaire