if (rem != -1) {
if (rem != -1 && rem < attach.size()) {
		public void actionPerformed(ActionEvent e) {			String arg = ((JButton)e.getSource()).getText();			if (arg.equals(YAMM.getString("button.send")) &&								isSendReady()) {				try {					PrintWriter outFile = new PrintWriter(						new FileOutputStream(						YAMM.home + "/boxes/" +						YAMM.getString("box.outbox"),						true)					);					SimpleDateFormat df =						new SimpleDateFormat(								"EEE, dd MMM yyyy " +							"HH:mm:ss zzz",							Locale.US						);					String to = myTextField1.getText();					String to2 = "";					String temp = null;					StringTokenizer tok =						new StringTokenizer(to, ",");					while (tok.hasMoreTokens()) {						temp = tok.nextToken().trim();						if (to2.equals("")) {							to2 = temp;						} else {							to2 += "      " + temp;						}						if (tok.hasMoreTokens()) {							to2 += ",\n";						}					}					if (attach.size() == 0) {						outFile.println("Date: " +						df.format(new Date()) +						"\nFrom: " +						YAMM.getProperty("username",							"Anonymous") +						" <" + YAMM.getProperty("email",							" ") + ">" +						"\nTo: " + to2 +						"\nSubject: " +						myTextField2.getText() +						"\nX-Mailer: " +						"Yet Another Mail Manager " +						YAMM.version + "\n\n" +						myTextArea.getText() +						"\n\n.\n");					} else {						outFile.println("Date: " +						df.format(new Date()) +						"\nFrom: " +						YAMM.getProperty("username",								"Anonymous") +						" <" + YAMM.getProperty("email",								" ") + ">" +						"\nTo: " + to2 +						"\nSubject: " +						myTextField2.getText() +						"\nX-Mailer: " +						"Yet Another Mail Manager " +						YAMM.version +						"\nMIME-Version: 1.0" +						"\nContent-Type: " +						"multipart/mixed; " +						"boundary=\"AttachThis\"" +						"\n" +						"\nThis is a multi-part " +						"message in MIME format." +						"\n" +						"\n--AttachThis" +						"\nContent-Type: text/plain; " +						"charset=us-ascii" +						"\nContent-Transfer-Encoding:" +						" 7bit" +						"\n\n" + myTextArea.getText() +						"\n\n");					}					outFile.close();					if (attach.size() > 0) {						new UUEncode(attach);					}				} catch (IOException ioe) {					new ExceptionDialog(						YAMM.getString("msg.error"),						ioe,						YAMM.exceptionNames);				}				Rectangle rv = new Rectangle();				getBounds(rv);				YAMM.setProperty("writex",					new Integer(rv.x).toString());				YAMM.setProperty("writey",					new Integer(rv.y).toString());				YAMM.setProperty("writew",					new Integer(rv.width).toString());				YAMM.setProperty("writeh",					new Integer(rv.height).toString());				dispose();			} else if (arg.equals(YAMM.getString("button.add"))) {				addAttach();			} else if (arg.equals(YAMM.getString(							"button.delete"))) {				int rem = myList.getSelectedIndex();				if (rem != -1) {					attach.remove(rem);					myList.updateUI();				}			} else if (arg.equals(YAMM.getString(							"button.cancel"))) {				Rectangle rv = new Rectangle();				getBounds(rv);				YAMM.setProperty("writex",					new Integer(rv.x).toString());				YAMM.setProperty("writey",					new Integer(rv.y).toString());				YAMM.setProperty("writew",					new Integer(rv.width).toString());				YAMM.setProperty("writeh",					new Integer(rv.height).toString());				dispose();			} else {				new MsgDialog(YAMMWrite.this,					YAMM.getString("msg.error"),					"Missing \"@\" in address field!");			}		}