private void renameRemote() {
		final int select = remoteList.getSelectedIndex();
		if (select < 0 || select > remotefiles.length || client == null) {
			return;
		}
		showDialog(remotefiles[select].getFileName(), new KeyListener() {

			@Override
			public void keyPressed(KeyEvent e) {
				if (e.getKeyCode() == 27)
					dialog.setVisible(false);
			}

			@Override
			public void keyReleased(KeyEvent e) {
			}

			@Override
			public void keyTyped(KeyEvent e) {
				if (e.getKeyChar() == '\n') {
					String oldname = remotefiles[select].getFileName();
					String foldername = tf.getText();
					try {
						if (client != null && !oldname.equals(foldername) && client.rename(oldname, foldername))
							refreshRemote();
					} catch (IOException e1) {
						e1.printStackTrace();
					}
					dialog.setVisible(false);
				}
			}
		});
	}