Why StringProperty[value: “”] is displayed in my table

后端 未结 1 478
鱼传尺愫
鱼传尺愫 2021-01-21 21:07

I\'m trying to show some information in a TableView, but I\'m facing some issues that I can\'t fix.

Here is what I\'m trying to do:

I have a R

相关标签:
1条回答
  • 2021-01-21 21:29

    You didn't obey JavaFX specific accessor syntax in your Room datamodel:

    If the field is ObservableValue like:

    private StringProperty val = new SimpleStringProperty();
    

    There should be accessors as:

    public String getVal() {
        val.get();
    }
    
    public void setVal(String newVal) {
        val.set(newVal);
    }
    
    public StringProperty valProperty() {
        return val;
    }
    

    Note the method valProperty. Also see this Q&A entry.

    0 讨论(0)
提交回复
热议问题