title: JavaFX custom control (TextField) not working
body: <p>I am trying to make a custom control with JavaFX and SceneBuilder 1.1.</p>
  
  <p>I have this code:</p>
  
  <p>FXML</p>
  
  <hr>
  
  <pre><code>&lt;?import libreria.javaFX.componentes.componenteTextField.*?&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"&gt;
    &lt;children&gt;
      &lt;CustomComponent fx:id="pastaTxt" layoutX="69.0" layoutY="87.0" prefWidth="200.0" /&gt;
    &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>CustomComponent.java</p>
  
  <hr>
  
  <pre><code>package libreria.javaFX.componentes.componenteTextField;
  
  import javafx.scene.control.TextField;
  
  public class CustomComponent extends TextField {
  
  public CustomComponent() {
      super();
      // TODO Auto-generated constructor stub
  }
  
  public CustomComponent(String arg0) {
      super(arg0);
      // TODO Auto-generated constructor stub
  }
  </code></pre>
  
  <p>}</p>
  
  <hr>
  
  <p>When I try to open it from SceneBuilder it tells me this: </p>
  
  <blockquote>
    <p>Missing types are: [CustomComponent] </p>
  </blockquote>
  
  <p>and it gives me the chance to specify the Classpath (which doesn't fix the problem either). </p>
  
  <p>I tried putting the class at the import statement too, like this:</p>
  
  <pre><code>&lt;?import libreria.javaFX.componentes.componenteTextField.CustomComponent?&gt;
  </code></pre>
  
  <p>But it gives a <code>ClassNotFoundException</code>.</p>
  
  <p>Any ideas about why is this happening?</p>
  
  <hr>
  
  <p><strong>MORE INFORMATION</strong></p>
  
  <p>I have done a new project with just these classes:</p>
  
  <p><img src="https://i.stack.imgur.com/g3EOo.png" alt="enter image description here"></p>
  
  <p>And the code is as follows:</p>
  
  <p><strong>CustomControl.fxml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import custom.CustomControl?&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;?scenebuilder-classpath-element ../../bin/custom?&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"&gt;
    &lt;children&gt;
      &lt;CustomControl layoutX="51.0" layoutY="100.0" prefWidth="200.0" /&gt;
    &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p><strong>CustomControl.java</strong></p>
  
  <pre><code>package custom;
  
  import javafx.scene.control.TextField;
  
  public class CustomControl extends TextField {
  
      public CustomControl() {
          super();
      }
  
  public CustomControl(String arg0) {
      super(arg0);
  
      }
  }
  </code></pre>
  
  <p>And I still have the same problem. I specify the classpath with the dialog, everything seems right to me but I have the same errors opening the SceneBuilder.</p>
  
  <hr>
  
  <p><strong>LAST INFORMATION</strong></p>
  
  <p><strong>Trying to approach to the solution, we tried this project under Eclipse. The result is that Eclipse shows the window ok but SceneBuilder continues with those errors. I hope this clue helps.</strong></p>
  
  <p><strong>If anyone has done this kind of custom control definition under Scene Builder, please, tell us and give us an example, it will be extremely helpful for our project.</strong></p>