2017-04-05 40 views
0

心中已經擴展一個JavaFX標籤。JavaFX的標籤擴展無法強迫

public class UpdateLabel extends Label{ 
    private StringProperty updateKeyPrefix = new SimpleStringProperty(); 
    public String getUpdateKeyPrefix(){ 
     return this.updateKeyPrefix.get(); 
    } 
    public void setUpdateKeyPrefix(String updateKeyPrefix){ 
     this.updateKeyPrefix.set(updateKeyPrefix); 
    } 

    private ObjectProperty<Enum<?>> updateKeyEnum = new SimpleObjectProperty<>(); 
    public Enum<?> getUpdateKeyEnum(){ 
     return this.updateKeyEnum.get(); 
    } 
    public void setUpdateKeyEnum(Enum<?> updateKeyEnum){ 
     this.updateKeyEnum.set(updateKeyEnum); 
    } 

    public Update getUpdate(){ 
     return new Update(this.getUpdateKeyEnum(), this.getUpdateKeyPrefix(), null); 
    } 
} 

現在,當我使用它在我的FXML我得到以下錯誤:

enter image description here

我仍然可以編譯不管,但是當我運行它,我得到這個: enter image description here

回答

1

好吧,已經發現它了:我沒有擴展正確的Label類。 (Java.awt而不是JavaFX)。