Lignes vides lors de l'ajout de nouvelles lignes dans TableView JavaFX
Bonjour,
Je débute en JAVA et je rencontre depuis près de 3 jours un problème lors de l'ajout de nouvelles lignes dans mon mon tableau fait sous scene Builder.
Lors de l'exécution du code, les lignes apparaissent vident.
******* Le modèle
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class InvoiceEntry {
private final SimpleStringProperty colstatuta;
private final SimpleStringProperty coldathra;
private final SimpleStringProperty coldestia;
private final SimpleStringProperty colmsga;
private final SimpleStringProperty colexpda;
public InvoiceEntry(String statut,String dathr,String desti,String msg,String expd) {
this.colstatuta = new SimpleStringProperty(statut);
this.coldathra = new SimpleStringProperty(dathr);
this.coldestia = new SimpleStringProperty(desti);
this.colmsga = new SimpleStringProperty(msg);
this.colexpda = new SimpleStringProperty(expd);
}
public String getcolstatut() {
return colstatuta.get();
}
public String getcoldathr() {
return coldathra.get();
}
public String getcoldesti() {
return coldestia.get();
}
public String getcolmsg() {
return colmsga.get();
}
public String getcolexpd() {
return colexpda.get();
}
public void setstatut(String statut) {
colstatuta.set(statut);
}
public void setdathr(String dathr) {
coldathra.set(dathr);
}
public void setdesti(String desti) {
coldestia.set(desti);
}
public void setmsg(String msg) {
colmsga.set(msg);
}
public void setexpd(String expd) {
colexpda.set(expd);
}
public StringProperty statutProperty() {
return colstatuta;
}
public StringProperty dathrProperty() {
return coldathra;
}
public StringProperty destiProperty() {
return coldestia;
}
public StringProperty msgProperty() {
return colmsga;
}
public StringProperty expdProperty() {
return colexpda;
} |
******** Mon controlleur
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| @FXML
private TableView<InvoiceEntry> listrapport;
@FXML
private TableColumn<InvoiceEntry, String> colstatuta;
@FXML
private TableColumn<InvoiceEntry, String> coldathra;
@FXML
private TableColumn<InvoiceEntry, String> coldestia;
@FXML
private TableColumn<InvoiceEntry, String> colmsga;
@FXML
private TableColumn<InvoiceEntry, String> colexpda;
private ObservableList<InvoiceEntry> datas;
@Override
public void initialize(URL url, ResourceBundle rb) {
colstatuta.setCellValueFactory(new PropertyValueFactory<>("colstatuta"));
coldathra.setCellValueFactory(new PropertyValueFactory<>("coldathra"));
coldestia.setCellValueFactory(new PropertyValueFactory<>("coldestia"));
colmsga.setCellValueFactory(new PropertyValueFactory<>("colmsga"));
colexpda.setCellValueFactory(new PropertyValueFactory<>("colexpda"));
datas = FXCollections.observableArrayList();
datas.add(new InvoiceEntry("Jacob", "Smith", "jacob.smith@example.com", "popopop",
"ererree"));
listrapport.setItems(datas);
} |