HTMLTextArea.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
public void exportToClipboard(JComponent comp, Clipboard clip, int action) {
    try {
        int selStart = getSelectionStart();
        int selLength = getSelectionEnd() - selStart;

        StringWriter plainTextWriter = new StringWriter();

        try {
            new ExtendedHTMLWriter(plainTextWriter, (HTMLDocument) getDocument(), selStart, selLength).write();
        } catch (Exception e) {
        }

        String plainText = NcrToUnicode.decode(plainTextWriter.toString());
        clip.setContents(new StringSelection(plainText), null);

        if (action == TransferHandler.MOVE) {
            getDocument().remove(selStart, selLength);
        }
    } catch (BadLocationException ble) {
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号