if (!e.isTemporary() && textComponent.getSelectionStart() != textComponent.getSelectionEnd()) { SecurityManager sm = System.getSecurityManager(); try { if (sm != null) sm.checkSystemClipboardAccess();  Clipboard cb = Toolkit.getDefaultToolkit().getSystemSelection(); if (cb != null) { StringSelection selection = new StringSelection(textComponent.getSelectedText()); cb.setContents(selection, selection); } } catch (SecurityException se) {   } catch (HeadlessException he) {   } catch (IllegalStateException ise) {  } }
      public void focusLost(FocusEvent e)      {        textComponent.repaint();      }