I have a FXML file, on which is ListView and next to it TextFields. How can I synchronize ID's from table on ListView with rest records in table?
For example when I click ID "1" on ListView then NAME and LASTNAME from my database (which are rest records with primary key ID "1") appears in TextField1 and TextField2)
@Override
public void initialize(URL location, ResourceBundle resources) {
db.getConnect();
con = db.getConnect();
try {
pst1 = con.prepareStatement("SELECT idpatient FROM patient");
rs1 = pst1.executeQuery();
while(rs1.next())
{
ObservableList<String> ids = FXCollections.observableArrayList(rs1.getString("idpatient"));
patientList.setItems(ids);
}
This code displays only last row from column "idpatient", but I want to display whole column... how can I do it?