diff options
Diffstat (limited to 'Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java')
| -rw-r--r-- | Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java b/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java index ccc32c4a..4c6e5629 100644 --- a/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java +++ b/Dozentenmodul/src/gui/image/EditImageAllgemein_GUI.java @@ -65,8 +65,10 @@ public class EditImageAllgemein_GUI extends JFrame { private JPanel buttonPane; private JButton backButton; private JButton okButton; - boolean textfieldsHaveContent = false; //no textfield is empty - boolean nameIsOK = false; //imagename only contains letters + private boolean textfieldsHaveContent = false; //no textfield is empty + private boolean nameIsOK = false; //imagename only contains letters + private boolean descriptionLengthOK = false; //description may not be longer than MAX_DESCRIPTION_LENGTH + private final int MAX_DESCRIPTION_LENGTH = 254; /** * Create the dialog. @@ -313,7 +315,7 @@ public class EditImageAllgemein_GUI extends JFrame { public void actionPerformed(ActionEvent arg0) { // Prueft die Eingabe und leitet weiter zur naechsten // Seite - if (checkContent() == true && checkNameIsLettersOrNumbers() == true) { + if (checkContent() == true && checkNameIsLettersOrNumbers() == true && descriptionLenghtOK()== true) { // setze Namen, egal ob alt oder nicht Image.image.setImagename(imagename.getText()); @@ -507,6 +509,23 @@ public class EditImageAllgemein_GUI extends JFrame { return textfieldsHaveContent; }//end checkContent - + public boolean descriptionLenghtOK(){ + descriptionLengthOK=false; + + //max length is 254 chars + if (textAreadesc.getText().length() >= MAX_DESCRIPTION_LENGTH) { + descriptionLengthOK=false; + JOptionPane + .showMessageDialog(null, + "Die Beschreibung darf max 254 Zeichen enthalten. Aktuell enthält sie "+textAreadesc.getText().length()+".", + "Beschreibung zu umfangreich", + JOptionPane.INFORMATION_MESSAGE); + }else { + descriptionLengthOK=true; + + } + + return descriptionLengthOK; + }// enddescriptionLenghtOK() }//end class |
