Warn if Textarea limit has been reached
authoramwaterhouse <Andrew Waterhouse>
Thu, 9 Jun 2005 09:58:53 +0000 (09:58 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 9 Jun 2005 09:58:53 +0000 (09:58 +0000)
src/jalview/appletgui/CutAndPasteTransfer.java

index ed89001..46f3d70 100755 (executable)
@@ -52,6 +52,23 @@ public class CutAndPasteTransfer
   protected void ok_actionPerformed(ActionEvent e)\r
   {\r
     String text = getText();\r
+    int length = text.length();\r
+    textarea.append("\n");\r
+    if(textarea.getText().length()==length)\r
+    {\r
+      String warning = "\n\n#################################################\n"\r
+          +"WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n"\r
+          +"\nCAN'T INPUT FULL ALIGNMENT"\r
+          +"\n\nYOU MUST DELETE THIS WARNING TO CONTINUE"\r
+          +"\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE"\r
+          +"\n#################################################\n";\r
+      textarea.setText(text.substring(0, text.length()-warning.length())\r
+          +warning);\r
+\r
+      textarea.setCaretPosition(text.length());\r
+      return;\r
+    }\r
+\r
     SequenceI[] sequences = null;\r
 \r
     String format = IdentifyFile.Identify(text, "Paste");\r