@Override
		public void selectionDone(SelectionEvent evt) {
			if (!useUnixTextSelection)
				return;
			Object o = evt.getSelection();
			if (!(o instanceof CharacterIterator))
				return;
			CharacterIterator iter = (CharacterIterator) o;
			// first see if we can access the clipboard
			if (!PermissionChecker.getInstance().checkPermission(new AWTPermission("accessClipboard"))) {
				// Can't access clipboard.
				return;
			}
			int sz = iter.getEndIndex() - iter.getBeginIndex();
			if (sz == 0)
				return;
			char[] cbuff = new char[sz];
			cbuff[0] = iter.first();
			for (int i = 1; i < cbuff.length; ++i) {
				cbuff[i] = iter.next();
			}
			final String strSel = new String(cbuff);
			// HACK: getSystemClipboard sometimes deadlocks on
			// linux when called from the AWT Thread. The Thread
			// creation prevents that.
			new Thread() {
				@Override
				public void run() {
					Clipboard cb;
					cb = Toolkit.getDefaultToolkit().getSystemClipboard();
					StringSelection sel;
					sel = new StringSelection(strSel);
					cb.setContents(sel, sel);
				}
			}.start();
		}
@Override
		public void selectionDone(SelectionEvent evt) {
			if (!useUnixTextSelection)
				return;
			Object o = evt.getSelection();
			if (!(o instanceof CharacterIterator))
				return;
			CharacterIterator iter = (CharacterIterator) o;
		
			if (!PermissionChecker.getInstance().checkPermission(new AWTPermission("accessClipboard"))) {
			
				return;
			}
			int sz = iter.getEndIndex() - iter.getBeginIndex();
			if (sz == 0)
				return;
			char[] cbuff = new char[sz];
			cbuff[0] = iter.first();
			for (int i = 1; i < cbuff.length; ++i) {
				cbuff[i] = iter.next();
			}
			final String strSel = new String(cbuff);
		
		
		
			new Thread() {
				@Override
				public void run() {
					Clipboard cb;
					cb = Toolkit.getDefaultToolkit().getSystemClipboard();
					StringSelection sel;
					sel = new StringSelection(strSel);
					cb.setContents(sel, sel);
				}
			}.start();
		}
@override public void selectiondone(selectionevent evt) { if (!useunixtextselection) return; object o = evt.getselection(); if (!(o instanceof characteriterator)) return; characteriterator iter = (characteriterator) o; if (!permissionchecker.getinstance().checkpermission(new awtpermission("accessclipboard"))) { return; } int sz = iter.getendindex() - iter.getbeginindex(); if (sz == 0) return; char[] cbuff = new char[sz]; cbuff[0] = iter.first(); for (int i = 1; i < cbuff.length; ++i) { cbuff[i] = iter.next(); } final string strsel = new string(cbuff); new thread() { @override public void run() { clipboard cb; cb = toolkit.getdefaulttoolkit().getsystemclipboard(); stringselection sel; sel = new stringselection(strsel); cb.setcontents(sel, sel); } }.start(); }