日期:2014-05-20 浏览次数:21048 次
try {
// Get the text pane's document
JTextPane textPane = new JTextPane();
StyledDocument doc = (StyledDocument)textPane.getDocument();
// The image must first be wrapped in a style
Style style = doc.addStyle("StyleName", null);
StyleConstants.setIcon(style, new ImageIcon("imagefile"));
// Insert the image at the end of the text
doc.insertString(doc.getLength(), "ignored text", style);
} catch (BadLocationException e)
{
}
------解决方案--------------------
你用传送图片字节流,传送过去,先传送一个值提示要接收图片,然后开始接收,对方开始接收图片字节流,完成后软件显示处理显示图片
具体用法:没具体研究过。。。