ciplogic/Fx2C

Problem compiling FXMLs with javafx.scene.control components

Closed this issue · 1 comments

Whenever there is an import of a class under the javafx.scene.control package, I get the following exception
java.lang.IllegalStateException: Toolkit not initialized

Here is an example of the FXML that I try to compile:

<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.String?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.StackPane?>

<StackPane fx:id="stackPane" alignment="TOP_CENTER" maxHeight="500.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="test.PopupController">
   <children>
      <GridPane fx:id="gridPane" alignment="TOP_CENTER" >
        <columnConstraints>
          <ColumnConstraints hgrow="ALWAYS" />
            <ColumnConstraints />
        </columnConstraints>
         <children>
            <Label    fx:id="lblTitle" text="Title" GridPane.rowIndex="1" />
            <ListView fx:id="listView" GridPane.rowIndex="2"/>
            <Button   fx:id="btnBack" text="Back" GridPane.rowIndex="3"/>
         </children>
      </GridPane>
   </children>
</StackPane>

It looks that for a weird reason JavaFx would not initialize in this case. This makes reflection not to work.

I made sure that it will do.

Thank you for this bug!