dcsimg

How do I insert an image into a JTextPane?

John Zukowski

Style style = document.addStyle
  ("StyleName", null);
StyleConstants.setIcon(style, 
  new ImageIcon(imageFile));
document.insertString(doc.getLength(), 
  "text to be ignored", style);
Be sure to deal with the BadLocationException.