private void jButtonEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditActionPerformed
        DefaultTableModel model = (DefaultTableModel) SupplierTable.getModel();
        if (SupplierTable.getSelectedRow() == -1) {
            if (SupplierTable.getRowCount() == 0) {
                JOptionPane.showMessageDialog(this, "Suppliers table is empty.");
            } else {
                JOptionPane.showMessageDialog(this, "Select from supplier please.");
            }
        } else {
//            try{
//           String nameToEdit = String.valueOf(SupplairTable.getValueAt(SupplairTable.getSelectedRow(),0));
//           Supplier supplier = th.get(nameToEdit);
//           if (supplier != null){
//               EditGUI.setVisible(true);
//               editSupplierNameField.setText(supplier.getName());
//               editSupplierAdressField.setText(supplier.getAdress());
//               editSupplierContactField.setText(supplier.getContact());
//               editSupplierOtherField.setText(supplier.getOther());
//           }
//            } 
//            catch (ClassNotFoundException | SQLException e){
//                Logger.getLogger(OfficeWorkerGUI.class.getName()).log(Level.SEVERE, null, e);
//            }
            try {
                String nameToEdit = String.valueOf(SupplierTable.getValueAt(SupplierTable.getSelectedRow(), 0));
                supplierToEdit = th.get(nameToEdit);

                if (supplierToEdit != null) {
                    EditGUI.setVisible(true);
                    editSupplierNameField.setText(supplierToEdit.getName());
                    editSupplierAdressField.setText(supplierToEdit.getAdress());
                    editSupplierContactField.setText(supplierToEdit.getContact());
                    editSupplierOtherField.setText(supplierToEdit.getOther());
                }
            } catch (ClassNotFoundException | SQLException e) {
                Logger.getLogger(OfficeWorkerGUI.class.getName()).log(Level.SEVERE, null, e);
            }
        }
    }//GEN-LAST:event_jButtonEditActionPerformed