- imported custom control "UTextFld" to Scene Builder (import JAR/FXML file)
- custom control is displayed correctly in "custom" area
- when custom control is dragged to content area, Scene Builder freezes for some seconds, after that the Scene Builder main window is automatically closed
fxml-file of custom control:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<fx:root type="javafx.scene.layout.HBox" xmlns:fx="http://javafx.com/fxml">
<Label text="Label1" />
<Label text="Label2" />
</fx:root>
java-file of custom control:
package com.unitechnik;
import java.io.IOException;
import javafx.fxml.*;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
public class UTextFld extends HBox
{
@FXML private TextField textField;
public UTextFld()
{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/com/unitechnik/UTextFld.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
}