private void removejButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_removejButton1ActionPerformed if (supplierjTable1.getSelectedRowCount() == 0) { return; } int selectedRow = supplierjTable1.getSelectedRow(); Supplier s = (Supplier) supplierjTable1.getValueAt(selectedRow, 0); supplierDir.removeSupplier(s); refreshjButton1ActionPerformed(null); } // GEN-LAST:event_removejButton1ActionPerformed
private void refreshjButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_refreshjButton1ActionPerformed // TODO add your handling code here: int rowCount = supplierjTable1.getRowCount(); for (int i = rowCount - 1; i >= 0; i--) { ((DefaultTableModel) supplierjTable1.getModel()).removeRow(i); } ArrayList<Supplier> supplierList = supplierDir.getSupplierList(); for (Supplier s : supplierList) { Object row[] = new Object[1]; row[0] = s; ((DefaultTableModel) supplierjTable1.getModel()).addRow(row); } } // GEN-LAST:event_refreshjButton1ActionPerformed