title: Blank Window JavaFX
body: <p>How do i fix this, a blank window opens on running the project</p>
  
  <p>this is my main:</p>
  
  <pre><code>package application;
  
  import java.io.IOException;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.stage.Stage;
  import javafx.scene.Scene;
  import javafx.scene.layout.AnchorPane;
  import javafx.scene.layout.BorderPane;
  
  
  public class Main extends Application {
  
  private Stage primaryStage;
  
  @Override
  public void start(Stage primaryStage) {
      this.primaryStage = primaryStage;
      primaryStage.show();
  }
  
  public void mainWindow() {
      try {
          FXMLLoader loader =new FXMLLoader(Main.class.getResource("/MainWindowView.fxml"));
          AnchorPane pane = loader.load();
          MainWindowController mainWindowController = loader.getController();
          mainWindowController.setMain(this);
          Scene scene = new Scene(pane);
          primaryStage.setScene(scene);
          primaryStage.show();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  
  public static void main(String[] args) {
      launch(args);
      }
  }
  </code></pre>
  
  <p>this is my view xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.layout.AnchorPane?&gt;
  
  &lt;AnchorPane prefHeight="1080.0" prefWidth="1920.0" 
  xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" 
  fx:controller="application.MainWindowController"&gt;
  &lt;children&gt;
    &lt;Label fx:id="label" alignment="CENTER" layoutY="420.0" text="Label" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"&gt;
       &lt;font&gt;
          &lt;Font size="71.0" /&gt;
       &lt;/font&gt;
    &lt;/Label&gt;
    &lt;HBox alignment="CENTER" layoutX="774.0" layoutY="540.0" spacing="20.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"&gt;
       &lt;children&gt;
          &lt;TextField layoutX="774.0" layoutY="540.0" /&gt;
          &lt;Button layoutX="1268.0" layoutY="540.0" mnemonicParsing="false" onAction="#handleButton" text="Click Me!" /&gt;
      &lt;/children&gt;
      &lt;/HBox&gt;
  &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>and this is my controller:</p>
  
  <pre><code>package application;
  
  import java.awt.Label;
  import java.awt.TextField;
  
  import javafx.fxml.FXML;
  
  public class MainWindowController {
  
      @FXML private Label label;
      @FXML private TextField field;
  
  
      private Main main;
  
      public void setMain(Main main) {
  
          this.main = main;
  
      }
  
      public void handleButton() {
  
          String text = field.getText();
          label.setText(text);
  
      }
  
  }
  </code></pre>
  
  <p>this link has a link to all three of these codes in hastebin if want to be viewed that way(<a href="https://pastebin.com/raw/hbGBJUng" rel="nofollow noreferrer">https://pastebin.com/raw/hbGBJUng</a>), im new to java and javafx and am not sure what i am doing wrong as when i run the project in the eclipse it shows me an empty window as when i open the xml in scenebuilder, I have added a button, a label and a text field.</p>