berber69
Messages postés2Date d'inscriptionmardi 22 septembre 2015StatutMembreDernière intervention 4 décembre 2019
-
Modifié le 2 juin 2018 à 11:05
H_Le_Grand
Messages postés8Date d'inscriptionjeudi 2 août 2018StatutMembreDernière intervention 2 septembre 2020
-
2 août 2018 à 13:36
j'ai utilisé TableView avec javaFX le résultat aucune donnée n'est afficher dans la table
package view;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
public class Consulter_stock implements Initializable{
public Consulter_stock() {
}
@FXML private TableView<Table> table;
@FXML private TableColumn<Table,String> desig;
@FXML private TableColumn<Table,Integer> qnt_en_stock;
@FXML private TableColumn<Table,Integer> qnt_sortie;
public ObservableList<Table> liste=FXCollections.observableArrayList(
new Table("preforme",12333,15)
);
@Override
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
desig.setCellValueFactory(new PropertyValueFactory<Table,String>("Désignation"));
qnt_en_stock.setCellValueFactory(new PropertyValueFactory<Table,Integer>("quantité en stock"));
qnt_sortie.setCellValueFactory(new PropertyValueFactory<Table,Integer>("qnt sortie"));
table.setItems(liste);
}
public static class Table{
private final SimpleStringProperty designation;
private final SimpleIntegerProperty qnt_stock;
private final SimpleIntegerProperty qnt_sortie;
public Table(String designation, int qnt_stock, int qnt_sortie) {
super();
this.designation = new SimpleStringProperty(designation);
this.qnt_stock = new SimpleIntegerProperty(qnt_stock);
this.qnt_sortie = new SimpleIntegerProperty(qnt_sortie);
}
public String getDesignation() {
return designation.get();
}
public int getQnt_stock() {
return qnt_stock.get();
}
public int getQnt_sortie() {
return qnt_sortie.get();
}
}
}