JavaFx 2.1, 2.2 TableView update issue

后端 未结 7 997
青春惊慌失措
青春惊慌失措 2021-02-06 17:41

My application uses JPA read data into TableView then modify and display them. The table refreshed modified record under JavaFx 2.0.3. Under JavaFx 2.1, 2.2, the table wouldn\'t

7条回答
  •  再見小時候
    2021-02-06 18:40

    Notification-based updates of JavaFX controls typically require that the properties of the data model object backing your GUI meet the minimum definition for a JavaFX Bean.

    The following exemplifies the minimum code needed in order for a JavaFX property to satisfy these requirements:

    public class Client extends DB {
    
        private IntegerProperty id =         new SimpleIntegerProperty();
        private StringProperty  lastName =   new SimpleStringProperty();
        private StringProperty  firstName =  new SimpleStringProperty();
    
    
        public final int getID() {return this.id.get(); }
        void setID(int id) { this.id.set(id); }
        public final IntegerProperty idProperty() { return this.id; }
    
        public final String getLastName() { return this.lastName.get(); }
        public final void setLastName(String ln) { this.lastName.set(ln); }
        public final StringProperty lastNameProperty() { return this.lastName; }
    
        public final String getFirstName() { return this.firstName.get(); }
        public final void setFirstName(String fn) { this.firstName.set(fn); }
        public final StringProperty firstNameProperty() { return this.firstName; }
        :
        :
    }    
    

    Glancing over your code, it does not appear that your properties satisfy the requirements for a JavFX Bean. As such, automatic notification-based updates will not occur.

提交回复
热议问题