JButton btnNewButton = new JButton("Confirm Deletion");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- if (table.getRowCount() != 0) {
+ if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
HouseManagerInterface hm = new HouseManager();
RuralHouse rh = houses.get(table.getSelectedRow());
((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
}
}
});
- btnNewButton.setBounds(301, 394, 169, 25);
+ btnNewButton.setBounds(90, 396, 169, 25);
contentPane.add(btnNewButton);
+
+ JButton btnNewButton_1 = new JButton("Deny Deletion");
+ btnNewButton_1.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
+ RuralHouse rh = houses.get(table.getSelectedRow());
+ ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
+ houses.remove(rh);
+ am.removeHouseDeletionRequests(rh);
+ Administrator.saveInstance();
+
+
+ }
+ }
+ });
+ btnNewButton_1.setBounds(291, 396, 169, 25);
+ contentPane.add(btnNewButton_1);
while (en.hasMoreElements()) {
rh = en.nextElement();
Vector<Object> row = new Vector<Object>();