I want to capture the contents of a specific cell in my table, in jtable I did it with:
myTable.getValueAt (int row, int column);
How can I do it in javaFX?
My code:
//Archivo controlador de la app.
public class FXMLDocumentController implements Initializable {
@FXML private TableView <Proceso> tablaInfo;
@FXML private TableColumn columnaId;
@FXML private TableColumn columnaNombre;
@FXML private TableColumn columnaQuantum;
@FXML private TableColumn columnaRecursos;
@FXML private TableColumn columnaEstado;
@FXML private TableColumn columnaTiempo;
ObservableList<Proceso> lista;
@FXML private void botonIniciarClicked(ActionEvent event) {
for (int i = 1 ; i < 13 ; i++){
int Q = (int)((Math.random()*29)+1);
Proceso proceso = new Proceso();
proceso.id.set(i);
proceso.nombre.set("Proceso "+i);
proceso.quantum.set(Q);
proceso.recursos.set(1);
proceso.estado.set("Ejecutando");
proceso.tiempo.set(1);
lista.add(proceso);
}
public void Procesar(int cont){
int idProcesar = tablaInfo.getValueAt(cont,0);
//Aqui surge el error, "cannot find symbol method getValueAt()"
}
}
//-----------------------Clase Proceso----------------------
public class Proceso{
public SimpleIntegerProperty id = new SimpleIntegerProperty();
public SimpleStringProperty nombre = new SimpleStringProperty();
public SimpleIntegerProperty quantum = new SimpleIntegerProperty();
public SimpleDoubleProperty recursos = new SimpleDoubleProperty();
public SimpleStringProperty estado = new SimpleStringProperty();
public SimpleIntegerProperty tiempo = new SimpleIntegerProperty();
public Integer getId() {
return id.get();
}
public String getNombre() {
return nombre.get();
}
public Integer getQuantum() {
return quantum.get();
}
public Double getRecursos() {
return recursos.get();
}
public String getEstado() {
return estado.get();
}
public Integer getTiempo() {
return tiempo.get();
}
}