I wrote the following code snippet thinking that I would be able to copy text into the system clipboard so that I could paste it into another application. But the text doesn't seem to make it to the clipboard.
...
JLabel label = new JLabel(selectedData); //
String selectedData holds text
label.setTransferHandler(new TransferHandler("text");
TransferHandler handler = label.getTransferHandler();
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
handler.exportToClipboard(label, clipboard, TransferHandler.COPY);
selectedData holds the text I want to export, but in WordPad the "Paste" button never gets enabled. Can anyone tell me why this doesn't work.