title: Using custom javafx label doesn't work
body: <p>Ok so I've created my own customer label, for this example it's extremely basic. What I did was extend the Javafx Label in my custom class called MyLabel. I'm also using FXML to create the GUI. Now when I do this I can't seem to instantiate with my custom class as I get this error.</p>
  
  <pre><code>"Can not set net.blacksquirreldevs.tests.MyLabel field net.blacksquirreldevs.tests.SampleLabelController.sampleLabel to javafx.scene.control.Label"
  </code></pre>
  
  <p>Here is the code for everything</p>
  
  <p>Main.java</p>
  
  <pre><code>package net.blacksquirreldevs.tests;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Scene;
  import javafx.scene.layout.AnchorPane;
  import javafx.stage.Stage;
  
  public class Main extends Application {
  
  @Override
  public void start(Stage primaryStage) throws Exception {
      primaryStage.setTitle("SampleLabel");
      AnchorPane anchorPane = (AnchorPane)     FXMLLoader.load(getClass().getResource("SampleLabel.fxml"));
  
      primaryStage.setScene(new Scene(anchorPane));
      primaryStage.show();
  }
  
  public static void main(String... args) {
      launch(args);
  }
  }
  </code></pre>
  
  <p>MyLabel.java</p>
  
  <pre><code>package net.blacksquirreldevs.tests;
  
  import javafx.scene.control.Label;
  
  
  public class MyLabel extends Label {
  
  public MyLabel(String text) {
      super();
      setText(text);
  }
  }
  </code></pre>
  
  <p>SampleLabelController.java</p>
  
  <pre><code>package net.blacksquirreldevs.tests;
  
  import javafx.fxml.FXML;
  
  import java.net.URL;
  import java.util.ResourceBundle;
  
  
  public class SampleLabelController {
  
  @FXML
  private ResourceBundle resources;
  @FXML
  private URL location;
  @FXML
  private MyLabel sampleLabel = new MyLabel("Hello world!");
  
  
  @FXML
  void initialize() {
      assert sampleLabel != null : "fx:id=\"sampleLabel\" was not injected: check your FXML file 'SampleLabel.fxml'.";
  
  
  }
  
  }
  </code></pre>
  
  <p>And finally the fxml file SampleLabel.fxml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.paint.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  
  &lt;AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml" fx:controller="net.blacksquirreldevs.tests.SampleLabelController"&gt;
  &lt;children&gt;
  &lt;Label fx:id="sampleLabel" layoutX="153.0" layoutY="171.0" text="Sample Text"&gt;
    &lt;font&gt;
      &lt;Font name="Arial Bold" size="50.0" /&gt;
    &lt;/font&gt;
  &lt;/Label&gt;
  &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>So what I want to know is why I can' declare, in my SamplelabelController class, the sampleLabel as MyLabel? </p>
  
  <p>Hopefully I've explained this well enough, if not let me know and I'll try to go a bit more in detail.</p>