I have a form that contains jTextPane and jButton , I set the jTextPane Accessible Description to text/html , now I want when I click on jButton to copy the contents from jTextPane to my clipboard, I tried this code:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { StringSelection stringSelection = new StringSelection (jTextPane1.getText()); Clipboard clpbrd = Toolkit.getDefaultToolkit ().getSystemClipboard (); clpbrd.setContents (stringSelection, null); }
but when I passed it passed the text in HTML format.
How can I solve this problem?
source share