{filelink=846}
Ce programme lit le contenu du presse-papier édite via la classe ‘TransferHandler’
private String paste()
{
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
String text="";
try
{ DataFlavor[] supportedFlavors= new DataFlavor[]{
new DataFlavor("text/html;class=java.lang.String"),
new DataFlavor("text/plain;class=java.lang.String")};
DataFlavor flavor = DataFlavor.selectBestTextFlavor(supportedFlavors);
if (clipboard.isDataFlavorAvailable(flavor))
{
text = (String) clipboard.getData(flavor);
// txtPaste.setText(text);
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e);
}
return text;
}