JavaFx SceneBuilder 2.0 does not allow custom controls

I have my own JavaFx control that appears in my application. But I can not get SceneBuilder to understand this.

I have CustomTextField.java/CustomTextField.fxml. CustomTextField inherits from UserControl as defined here , but the problem with the script creator happens with any custom control that I create.

First, I had to change my import statement as a wildcard. From

<import sample.CustomTextField> 

to

 <import sample.*> 

otherwise, the script threw an exception / showed a stacktrace indicating that the source file was not found. I have no idea why this was necessary, but it seemed to work, so I continued to move.

I read that you will also specify the scriptbuilder-classpath element in the fxml file. So, I tried every combination that 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 problem is that the user control is not displayed in Scene Builder. Selecting it in the hiearchy tree, he indicates that "The selection contains unresolved links." If I can not drag the user control, this is acceptable. However, I really want to do this in Scene Builder and post other materials.

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> 

project structure enter image description here

+8
java intellij-idea javafx scenebuilder
source share

No one has answered this question yet.

See related questions:

10
JavaFX user control (TextField) not working
5
Load FXML files using custom components in JavaFX Scene Builder: reset attributes and children removed
4
JavaFX user control - “root value already specified” in Scene Builder 2.0
2
set fx: id to buttons created in loops, javaFX
one
Cannot import custom components with custom cell factories
one
Access javaFX elements from Java code (external controller classes)
one
Why is SceneBuilder so specific to user controls?
0
Are JavaFX controller classes SceneBuilder and onActionEvents not applied by default?
0
Scene Builder only recognizes some of my FXML tags, but not all
0
JavaFX Scene Builder 2.0 and custom components

All Articles