我有包含jTextPane
和jButton
一个形式,我给自己定的jTextPane
Accessible Description
到text/html
,现在我想,当我在jButton
点击到jTextPane
的内容复制到剪贴板我,我试过这段代码:复制的JTextPane文本到剪贴板
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
StringSelection stringSelection = new StringSelection (jTextPane1.getText());
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents (stringSelection, null);
}
但是当我过去时,它以HTML格式过去文本。
我该如何解决这个问题?
正如我所看到的,问题在于设置或获取内容,它的ant将文本从JTextpane转换为纯文本(剥离HTML标签) – MadProgrammer 2013-04-23 22:09:39