Javafx - I cannot get data into a TableView

前端 未结 1 993
执念已碎
执念已碎 2021-01-25 01:30

I am unable to populate a JavaFX TableView object with my own data. I have attempted to modify the code found here to suit the needs of my program. I added the table used in th

相关标签:
1条回答
  • 2021-01-25 02:12

    The getters and setters on the SNMPInterface class that you use for input to PropertyValueFactory should be marked public, not no modifier (otherwise the reflection logic inherent in the PropertyValueFactory won't find them).

    public static class SNMPInterface {
        private final SimpleStringProperty ifIndex;
        private final SimpleStringProperty ifDescr;
    
        SNMPInterface( String ifIndex, String ifDescr ) {
            this.ifIndex = new SimpleStringProperty( ifIndex );
            this.ifDescr = new SimpleStringProperty( ifDescr );
        }
    
        public String getIfIndex() {
            return ifIndex.get();
        }
    
        public void setIfIndex( String index ) {
            ifIndex.set( index );
        }
    
        public String getIfDescr() {
            return ifDescr.get();
        }
    
        public void setIfDescr( String descr ) {
            ifDescr.set( descr );
        }
    }
    
    0 讨论(0)
提交回复
热议问题