I´m trying to add a color when the program starts. But I only want to add it in the first two rows and in a specific colum this is my code of the initialize
public void initialize(URL location, ResourceBundle resources) {
for (int i=0;i<28;i++){
if (i == 0 || i == 1){
listaPaginacion.add(new tablaPaginacion(i,"S.O.",0,"100","Ocupado"));
tvTablaPaginacion.setItems(listaPaginacion);
tcId.setCellValueFactory(new PropertyValueFactory<>("Id"));
tcPagina.setCellValueFactory(new PropertyValueFactory<>("Pagina"));
tcTam.setCellValueFactory(new PropertyValueFactory<>("Tam"));
tcTam.getStyleClass().add(i,"so-colum");
tcEstado.setCellValueFactory(new PropertyValueFactory<>("Estado"));
tcNumeroMarco.setCellValueFactory(new PropertyValueFactory<>("NumeroMarco"));
}else{
listaPaginacion.add(new tablaPaginacion(i,"",0,"0","Libre"));
tvTablaPaginacion.setItems(listaPaginacion);
tcId.setCellValueFactory(new PropertyValueFactory<>("Id"));
tcPagina.setCellValueFactory(new PropertyValueFactory<>("Pagina"));
tcTam.setCellValueFactory(new PropertyValueFactory<>("Tam"));
tcTam.getStyleClass().remove("so-colum");
tcEstado.setCellValueFactory(new PropertyValueFactory<>("Estado"));
tcNumeroMarco.setCellValueFactory(new PropertyValueFactory<>("NumeroMarco"));
}
}
}
I tried to first add the class and then remove it but it doesn't work