title: How to separate a JavaFX Appliciation
body: <p>I want to seperate a JavaFX project to model, view and controller. 
  I use netbeans when creating a JavaFX application. 
  But I want the code seperate, an own GUI, own logic and a Main class just to start the application (I want 3 seperate classes). 
  But I am not able to solve this problem. 
  The automatic created code looks like this:</p>
  
  <pre><code>package at.wueschn.www;
  
  import javafx.application.Application;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.layout.StackPane;
  import javafx.stage.Stage;
  
  public class Main extends Application {
  
  @Override
  public void start(Stage primaryStage) {
      Button btn = new Button();
      btn.setText("Say 'Hello World'");
      btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @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);
  }
  
    }
  </code></pre>