title: JavaFX custom component does not appear
body: <p>I'm trying create a custom component in JavaFX. This component is the base of the dialogs that will be used in the application, basically it is a BorderPane with custom a title in top and a button in the bottom. Here is a picture of the component in SceneBuilder:</p>
  
  <p><img src="https://i.stack.imgur.com/aI1vj.png" alt="dialogoComum.fxml in scene builder"></p>
  
  <p>and here is the fxml declaration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.net.*?&gt;
  &lt;?import javafx.geometry.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?scenebuilder-stylesheet ../css/style.css?&gt;
  
  &lt;fx:root type="javafx.scene.layout.BorderPane" xmlns:fx="http://javafx.com/fxml"&gt;
    &lt;bottom&gt;
      &lt;HBox alignment="CENTER_RIGHT" prefHeight="62.0" prefWidth="-1.0" BorderPane.alignment="CENTER"&gt;
        &lt;children&gt;
          &lt;Button fx:id="botaoConfirmar" alignment="CENTER" contentDisplay="RIGHT"    ellipsisString="" graphicTextGap="4.0" mnemonicParsing="false" onAction="#confirmar" prefHeight="35.0" prefWidth="165.0" style="-fx-background-color: #3a813f;" text="OK (F12)" textAlignment="CENTER" textFill="WHITE" wrapText="false"&gt;
            &lt;font&gt;
              &lt;Font name="System Bold" size="12.0" fx:id="x1" /&gt;
            &lt;/font&gt;
            &lt;stylesheets&gt;
              &lt;URL value="@../css/style.css" /&gt;
            &lt;/stylesheets&gt;
            &lt;HBox.margin&gt;
              &lt;Insets left="10.0" right="10.0" /&gt;
            &lt;/HBox.margin&gt;
          &lt;/Button&gt;
        &lt;/children&gt;
      &lt;/HBox&gt;
    &lt;/bottom&gt;
    &lt;stylesheets&gt;
      &lt;URL value="@../css/style.css" /&gt;
    &lt;/stylesheets&gt;
    &lt;top&gt;
      &lt;HBox alignment="TOP_LEFT" disable="true" fillHeight="true" focusTraversable="true" prefHeight="46.0" prefWidth="-1.0" spacing="0.0" style="-fx-background-color: #3a813f;&amp;#10;-fx-background-position: 100;" visible="true" BorderPane.alignment="CENTER"&gt;
        &lt;children&gt;
          &lt;Text fx:id="titulo" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="TITULO" textAlignment="CENTER" wrappingWidth="0.0" x="0.0" HBox.hgrow="ALWAYS"&gt;
            &lt;font&gt;
              &lt;Font size="20.0" /&gt;
            &lt;/font&gt;
            &lt;HBox.margin&gt;
              &lt;Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /&gt;
            &lt;/HBox.margin&gt;
          &lt;/Text&gt;
        &lt;/children&gt;
      &lt;/HBox&gt;
    &lt;/top&gt;
  &lt;/fx:root&gt;
  </code></pre>
  
  <p>As you could see, my intention is use this component as a base dialog and put the content of a specific dialog in center:</p>
  
  <p><img src="https://i.stack.imgur.com/sTQa9.png" alt="dialogoMensagem.fxml in scene builder"></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import com.lutum.ui.controladores.*?&gt;
  &lt;?import com.lutum.ui.controladores.DialogoComum?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import java.net.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.geometry.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.image.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.paint.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?scenebuilder-classpath-element ../../../../../target/ui-0.1.0.jar?&gt;
  
  &lt;DialogoComum maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2"&gt;
    &lt;center&gt;
      &lt;VBox prefHeight="-1.0" prefWidth="-1.0"&gt;
        &lt;children&gt;
          &lt;HBox maxWidth="400.0" minWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0"&gt;
            &lt;children&gt;
              &lt;ImageView id="icone" fitHeight="64.0" fitWidth="64.0" pickOnBounds="true" preserveRatio="true" HBox.hgrow="NEVER"&gt;
                &lt;HBox.margin&gt;
                  &lt;Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /&gt;
                &lt;/HBox.margin&gt;
              &lt;/ImageView&gt;
              &lt;Text id="mensagem" strokeType="OUTSIDE" strokeWidth="0.0" text="Text"&gt;
                &lt;HBox.margin&gt;
                  &lt;Insets right="10.0" top="20.0" /&gt;
                &lt;/HBox.margin&gt;
              &lt;/Text&gt;
            &lt;/children&gt;
          &lt;/HBox&gt;
          &lt;Accordion id="accordion" minHeight="0.0" minWidth="0.0" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"&gt;
            &lt;expandedPane&gt;
              &lt;TitledPane fx:id="x2" text="Detalhes"&gt;
                &lt;content&gt;
                  &lt;AnchorPane minHeight="-1.0" minWidth="-1.0" prefHeight="-1.0" prefWidth="-1.0"&gt;
                    &lt;children&gt;
                      &lt;Text id="detalhes" layoutX="14.0" layoutY="26.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" /&gt;
                    &lt;/children&gt;
                  &lt;/AnchorPane&gt;
                &lt;/content&gt;
              &lt;/TitledPane&gt;
            &lt;/expandedPane&gt;
            &lt;panes&gt;
              &lt;fx:reference source="x2" /&gt;
            &lt;/panes&gt;
            &lt;VBox.margin&gt;
              &lt;Insets left="10.0" right="10.0" /&gt;
            &lt;/VBox.margin&gt;
          &lt;/Accordion&gt;
        &lt;/children&gt;
      &lt;/VBox&gt;
    &lt;/center&gt;
  &lt;/DialogoComum&gt;
  </code></pre>
  
  <p>As you can see the component can be used correctly in SceneBuilder, however, the same don't happen when I use it in the application, I can simply see a white screen:</p>
  
  <p><img src="https://i.stack.imgur.com/VwlWA.png" alt="white screen"></p>
  
  <p>Here is the code for the DialogoComum (for dialogoComum.fxml):</p>
  
  <pre><code>public class DialogoComum extends BorderPane implements IControladorDialogo {
  
      @FXML
      protected Text titulo;
      protected URL modelo;
      protected Stage stage;
      protected List&lt;String&gt; estilos = new ArrayList&lt;String&gt;();
  
      public DialogoComum() {
          /*needed by SceneBuilder*/
          this.modelo = getClass().getResource("/gui/dialogos/dialogoComum.fxml");
          FXMLLoader fxmlLoader = new FXMLLoader(modelo);
          fxmlLoader.setRoot(this);
          fxmlLoader.setController(this);
          try {
              fxmlLoader.load();
          } catch (IOException exception) {
              throw new RuntimeException(exception);
          }
      }
  
      public DialogoComum (String nothing){
          //Just to not call the above constructor
      }
  
      @Override
      public final void init() {
          try {
              stage = new Stage();
              stage.setScene(carregarCena());
              stage.initStyle(StageStyle.UNDECORATED);
              stage.initModality(Modality.APPLICATION_MODAL);
              stage.setWidth(200);
              stage.setHeight(200);
              configurarElementos();
          } catch (IOException e) {
              throw new RuntimeException(e);
          }
      }
  
      protected final Scene carregarCena() throws IOException {
          SpringFXMLLoader.load(modelo.openStream(), this);
          Scene cena = new Scene(this);
          cena.getStylesheets().addAll(estilos);
          return cena;
      }
  
      protected void configurarElementos() {}
  
      @FXML
      public void confirmar(ActionEvent evento) {}
  
      @Override
      public void abrir() {
          stage.showAndWait();
      }
  
      @Override
      public void fechar() {
          stage.close();
      }
  }
  </code></pre>
  
  <p>and ControladorDialogoMensagem (for dialogoMensagem.fxml):</p>
  
  <pre><code>public class ControladorDialogoMensagem extends DialogoComum {
  
      @FXML
      private Text mensagem;
      @FXML
      private Text detalhes;
      @FXML
      private ImageView icone;
      @FXML
      private Accordion accordion;
      private URL iconeSucesso;
      private URL iconeAlerta;
      private URL iconeErro;
  
      public ControladorDialogoMensagem() {
          super(null);
      }
  
      .
      .
      .
  
      @FXML
      public void confirmar(ActionEvent e) {
          fechar();
      }
  }
  </code></pre>
  
  <p>finally here is the application code</p>
  
  <pre><code>public class AppBase extends Application implements ApplicationContextAware {
  
      protected ControladorDialogoMensagem dialogoMensagem;
      protected ApplicationContext contexto;
  
      public static void main(String args[]) {
          launch(args);
      }
  
      @Override
      public void start(Stage stage) throws Exception {
          ApplicationContext contexto = new ClassPathXmlApplicationContext("/spring/appContext.xml");
          dialogoMensagem=contexto.getBean(ControladorDialogoMensagem.class);
          dialogoMensagem.abrir();
      }
  
      .
      .
      .
  }
  </code></pre>
  
  <p>What can I do to solve it?</p>