I'm trying to figure out how to open a subclass of a custom component based on AnchorPane in SceneBuilder 2.0 - I've tried to reduce the problem to the most basic scenario and even after looking at the Oracle documentation I'm unable to get this working. I realize that there are other questions like this already on SO but these imply the use of a JAR, I don't have a JAR.
It's just simple simple stuff, what am I doing wrong?
TutoPane.java:
package tuto;
public class TutoPane extends javafx.scene.layout.AnchorPane {
}
Atut.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?scenebuilder-classpath-element ../../build/classes?>
<tuto.TutoPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tuto.AtutController">
</tuto.TutoPane>
When I open the fxml file in SceneBuilder I do not get a ClassNotFound exception, I do see in the main window the message "Content of this document cannot be displayed" and I see when I show in Preview mode the message "Not a Node". The "Not a Node" message especially has me stumped because tuto.TutoPane is a subclass of javafx.scene.layout.AnchorPane, since SceneBuilder isn't complaining that the class can't be found, it must know that it is a Node.
And if I edit the FXML and replace tuto.TutoPane by "AnchorPane" it does work.
OK it looks like I've been misled by some of the samples available on the internet, that show that you can import components by referencing their individual class files on the file system in the "scenebuilder-classpath".
My example works at design time in Scene Builder only when I bundle my classes in a JAR and import this JAR into the custom library folder. The "scenebuilder-classpath element" does not seem relevant at all for component discovery.