JavaFX,tableView在一列中缺少数据

时间:2019-02-25 06:48:06

标签: java javafx

在表视图中只有名称为“ col_rib”的一列没有显示数据

@FXML
private TableColumn<User, String> col_rib; 

col_rib.setCellValueFactory(new PropertyValueFactory<User, String> ("rib"));

这是控制器的代码:

 @FXML
private TableView<User> tableUser;

@FXML
private TableColumn<User, Integer> col_id;

@FXML
private TableColumn<User, String> col_nom;

@FXML
private TableColumn<User, String> col_prenom;


@FXML
private TableColumn<User, String> col_date;

@FXML
private TableColumn<User, Integer> col_cin;

@FXML
private TableColumn<User, Integer> col_tel;

@FXML
private TableColumn<User, String> col_adresse;

@FXML
private TableColumn<User, String> col_rib;


//    ObservableList<User> oblist = FXCollections.observableArrayList();
    ObservableList<User> oblist ;



@Override
public void initialize(URL location, ResourceBundle resources) {

    col_id.setCellValueFactory(new PropertyValueFactory<User, Integer>("id"));
    col_nom.setCellValueFactory(new PropertyValueFactory<User, String> ("nom"));
    col_prenom.setCellValueFactory(new PropertyValueFactory<User, String> ("prenom"));
    col_rib.setCellValueFactory(new PropertyValueFactory<User, String> ("rib"));
    col_date.setCellValueFactory(new PropertyValueFactory<User, String> ("DateNaissance"));
    col_cin.setCellValueFactory(new PropertyValueFactory<User, Integer>("cin"));
    col_tel.setCellValueFactory(new PropertyValueFactory<User, Integer>("telephone"));
    col_adresse.setCellValueFactory(new PropertyValueFactory<User, String> ("adresse"));




    Admin_service as = new Admin_service() ;
    oblist = as.getAll();
    tableUser.setItems(oblist);

“ col_rib”以外的其他列也可以正常工作

任何帮助请!

1 个答案:

答案 0 :(得分:0)

只需添加“ col_rib”属性的吸气剂! 感谢您对KAI的评论!