I have a table in javafx like this:
What I need is to change the color of the cells in the KmSopassed column according to the value it has. for example if the value is greater than 5000 it should appear in red if it is smaller yellow etc. here I have the code that fills the table:
@FXML
private TableView<Panel1> tblvehiculosproxmante;
private ObservableList<Panel1> infoproximos;
@FXML
private TableColumn<Panel1, String> clmnplaca;
@FXML
private TableColumn<Panel1, Number> clmnkmsobretiempo;
private Conexion conexion = new Conexion();
@FXML
private JFXButton btn_report_sobtiemp;
public void initialize(URL url, ResourceBundle rb) {
conexion = new Conexion();
conexion.establecerConexion();
infoproximos = FXCollections.observableArrayList();
Panel1.mostrarVehiculosProxMante(conexion.getConnection(), infoproximos);
tblvehiculosproxmante.setItems(infoproximos);
clmnplaca.setCellValueFactory(
new PropertyValueFactory<Panel1, String>("placa")
);
clmnkmsobretiempo.setCellValueFactory(
new PropertyValueFactory<Panel1, Number>("kmsobretiempo")
);
tblvehiculosproxmante.setItems(infoproximos);
}