JavaFX 8 - fx:include PropertyNotFoundException:属性“customEvent”不存在或是只读的

时间:2016-07-13 21:13:07

标签: javafx-8 fxml

我在运行时遇到以下异常。 sub fxml是一个Combobox,包含在Main fxml中。目标是使用fx-include标记中的customEvent =“#testSystemSelectAction”连接Combobox选择更改事件以刷新Main中的表

我错过了什么?

非常感谢!

例外:

Caused by: com.sun.javafx.fxml.PropertyNotFoundException: Property "customEvent" does not exist or is read-only.
at javafx.fxml.FXMLLoader$Element.processValue(FXMLLoader.java:348)
at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:325)
at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:235)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:767)
at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
... 67 more

Sub fxml控制器:

public class SystemComboboxUIController extends BaseController {
...
    private ObjectProperty<EventHandler<ActionEvent>> propertyCustomEvent = new SimpleObjectProperty<EventHandler<ActionEvent>>();

    public ObjectProperty<EventHandler<ActionEvent>> customEventProperty() {
        return this.propertyCustomEvent;
    }

    public void setCustomEvent(EventHandler<ActionEvent> customEvent) {
    this.customEventProperty().set(customEvent);
    }

    public EventHandler<ActionEvent> getCustomEvent() {
    return this.customEventProperty().get();
    }
    ...

主要fxml:

...
<fx:include source="SystemComboboxUI.fxml" fx:id="testSystemComboboxUI" customEvent="#testSystemSelectAction"/>
...

主控制器:

...
@FXML 
public void testSystemSelectAction(ActionEvent event) throws Exception {
    populateTableview();
}
...

0 个答案:

没有答案