@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == save) { try { DataBinder b = new DataBinder(); String firma = b.bindFrom_String(textfeld[0], new StandardRule()); String name = b.bindFrom_String(textfeld[1], new StandardRule()); String telefon = b.bindFrom_String(textfeld[2], new StandardRule()); if (!b.hasErrors()) { if (k != null) { k.setFirma(firma); k.setName(name); k.setTelefon(telefon); BL.updateKontakt(k); // JOptionPane.showMessageDialog(this, // "Eintrag wurde erfolgreich bearbeitet"); } else { k = new Kontakt(firma, name, telefon); BL.saveKontakt(k); // JOptionPane.showMessageDialog(this, // "Eintrag wurde erfolgreich hinzugefügt"); } dispose(); } else { JOptionPane.showMessageDialog(this, b.getErrors()); } } catch (IllegalArgumentException iae) { JOptionPane.showMessageDialog(this, iae.getMessage()); } catch (InvalidObjectException ioe) { JOptionPane.showMessageDialog(this, ioe.getMessage()); } catch (DALException de) { de.printStackTrace(); JOptionPane.showMessageDialog(this, de.getMessage()); System.out.println(de.getMessage()); } } else if (e.getSource() == cancel) { dispose(); } }