Don't know what I'm doing wrong here. I'm trying to delete the selected file from my directory but it's only deleting it from the list. Thanks
private void deletecustButtonActionPerformed(java.awt.event.ActionEvent evt) {
DefaultListModel model = (DefaultListModel) customerList.getModel();
int selectedIndex = customerList.getSelectedIndex();
File customer = new File("Customers/" + selectedIndex);
if (selectedIndex != 1) {
customer.delete();
model.remove(selectedIndex);
}
}
Aucun commentaire:
Enregistrer un commentaire