Thursday, January 17, 2013

Caused by: javafx.fxml.LoadException: ... is not a valid type.

It's a tips to include custom control(UI element) in FXML.

It's the FXML from the example "Embed WebView in FXML, to load OpenLayers with OpenStreetMap".

<?xml version="1.0" encoding="UTF-8"?>
 
<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafxml_web.*?>
 
<AnchorPane id="AnchorPane" prefHeight="500" prefWidth="660" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxml_web.Sample">
    <children>
        <MyBrowser id="mybrowser" layoutX="10" layoutY="10" prefHeight="460" prefWidth="620" fx:id="mybrowser" />
    </children>
</AnchorPane>


Where MyBrowser is a custom class defined in my package, javafxml_web. So, the statement <?import javafxml_web.*?> have to be added. Otherwise error will be reported, Caused by: javafx.fxml.LoadException: MyBrowser is not a valid type.

No comments:

Post a Comment