Mlezi
Mlezi

Reputation: 115

JavaFX Label extension unable to coerce

I'v extended a JavaFX Label.

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);
    }
}

Now when i use it in my fxml I get the following errors:

enter image description here

I can still compile regardless, but when I run it I get this: enter image description here

Upvotes: 0

Views: 2659

Answers (1)

Mlezi
Mlezi

Reputation: 115

Okay found it already: I wasn't extending the correct Label class. (Java.awt instead of the JavaFX one).

Upvotes: 1

Related Questions