I am developing a ticketing system using JavaFx. When the user selects a particular ticket in the table and clicks the "Edit" button, the data in the selected row is loaded into the corresponding fields in the form below. The user can then make changes and update the information.
However, I am having problems figuring out how to set the text in the choice boxes for "Status" and "Severity" to the text in the selected row. This is the code I have for the edit button so far:
@FXML
private void editButtonFired(ActionEvent event) {
try {
int value = table.getSelectionModel().getSelectedItem().getTicketNum();
JdbcRowSet rowset = RowSetProvider.newFactory().createJdbcRowSet();
rowset.setUrl(url);
rowset.setUsername(username);
rowset.setPassword(password);
rowset.setCommand("SELECT * FROM s_fuse_ticket_table WHERE ticket_id = ?");
rowset.setInt(1, value);
rowset.execute();
while(rowset.next()) {
ticketNumber.setText(rowset.getString(1));
summary.setText(rowset.getString(2));
}
}catch (SQLException e){
}
}
I tried using the .setSelectionModel() method but that didn't work. Could someone please assist me? Thank you!