I have a custom JavaFx control that renders in my application. But, I can't get SceneBuilder to understand it.
I have CustomTextField.java / CustomTextField.fxml. CustomTextField inherits from UserControl, as defined here, but my scene builder problem happens with any custom control that I create.
First, I had to change my import statement to be a wildcard. From
<import sample.CustomTextField>
to
<import sample.*>
otherwise, scenebuilder threw an exception / showed a stacktrace indicating that the source file couldn't be found. I have no idea why this was necessary, but it seemed to work, so I kept moving.
I had read that you to specify a scenebuilder-classpath-element in the fxml file as well. So, i tried every combination I could think of:
<?scenebuilder-classpath-element ../../bin?>
<?scenebuilder-classpath-element ../../out?>
<?scenebuilder-classpath-element ../../../out?>
<?scenebuilder-classpath-element ./?>
<?scenebuilder-classpath-element ../../../../../target/classes?>
My issue is that the custom control does not render in Scene Builder. SElecting it in the hiearchy tree, it indicates "Selection contains unresolved reference". If I can't drag/drop the custom control around, that's acceptable. However, I really want to render this in Scene Builder and lay out other stuff.
I am using IntelliJ IDEA 14, and Scene Builder 2.0
sample.fxml:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import sample.*?>
<?scenebuilder-classpath-element ../../bin?>
<?scenebuilder-classpath-element ../../out?>
<?scenebuilder-classpath-element ../../../out?>
<?scenebuilder-classpath-element ./?>
<?scenebuilder-classpath-element ../../../../../target/classes?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Button fx:id="topButton" layoutY="2.0" mnemonicParsing="false" text="Button Top" />
<CustomTextField fx:id="myCustomTextField" layoutX="1.0" layoutY="40.0" />
<Button layoutX="1.0" layoutY="125.0" mnemonicParsing="false" text="Button Bot" />
</children>
</Pane>