1

I have a problem with one of the columns I use in a tableview.
This column was initially used to show one type of data I have :

usageTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lusage"));

I wanted to change the data that is shown in this column, so I changed the column name in my FXML file and I wrote this :

systemeTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lSysteme"));

My ResearchData class is coded like this :

public class ResearchData {
    public int getRang() {
        return rang;
    }
    public void setRang(int rang) {
        this.rang = rang;
    public String getLusage() {
        return lusage;
    }
    public void setLusage(String lusage) {
        this.lusage = lusage;
    }
    public String getlSysteme() {
        return lSysteme;
    }
    public void setlSysteme(String lSysteme) {
        this.lSysteme = lSysteme;
    private int rang;
    private String lusage;
    private String lSysteme;


    public ResearchData(int rang, 
            String lusage, 
            String lSysteme) {
        this.rang= rang;
        this.lusage= lusage;
        this.lSysteme=lSysteme;
    }
}

(I only kept rang, lusage and lSysteme, but I have a lot of other variables written exactly like this).

When I launch the program, in the tableview, every column is displayed correctly except for the Systeme one, and I have this error message :

juin 10, 2022 10:55:35 AM javafx.scene.control.cell.PropertyValueFactory getCellDataReflectively
WARNING: Can not retrieve property 'lSysteme' in PropertyValueFactory: javafx.scene.control.cell.PropertyValueFactory@106b20b1 with provided class type: class codejava.ResearchData
java.lang.IllegalStateException: Cannot read from unreadable property lSysteme

I can print the Systeme data with the getter, and it corresponds to the one I have written.

Can you help me?

A.CAL
  • 41
  • 6

1 Answers1

1

I just had to replace

systemeTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lSysteme"));

with

systemeTab.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getlSysteme()));
A.CAL
  • 41
  • 6