if (selectedComponent instanceof JTextField) ((JTextField)selectedComponent).paste();
if (selectedComponent instanceof JTextComponent) ((JTextComponent)selectedComponent).paste();
    private void pasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pasteActionPerformed        if (selectedComponent == null)            return;                if (selectedComponent instanceof JTextField)            ((JTextField)selectedComponent).paste();        else if (selectedComponent instanceof JList) {            Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();            Transferable transfer = cb.getContents(this);            if (transfer.isDataFlavorSupported(DataFlavor.stringFlavor)) {                try {                    String path = (String)transfer.getTransferData(DataFlavor.stringFlavor);                    if (selectedComponent == jarFileList) {                        jarNameTextField.setText(path);                        addJarButtonActionPerformed(evt);                    }                    else if (selectedComponent == sourceDirList) {                        srcDirTextField.setText(path);                        this.addSourceDirButtonActionPerformed(evt);                    }                    else if (selectedComponent == classpathEntryList) {                        classpathEntryTextField.setText(path);                        addClasspathEntryButtonActionPerformed(evt);                    }                } catch (Exception e) {                }            }        }    }//GEN-LAST:event_pasteActionPerformed