Java - Convert Image to Icon/ImageIcon?

What's wrong with new ImageIcon(Image)?

Image img = ...
ImageIcon icon = new ImageIcon(img);

Add the image to your JTextPane document:

Image image = ImageIO.read(new File("myImage.jpg"));

StyleContext context = new StyleContext();
StyledDocument document = new DefaultStyledDocument(context);

Style labelStyle = context.getStyle(StyleContext.DEFAULT_STYLE);

Icon icon = new ImageIcon(image);
JLabel label = new JLabel(icon);
StyleConstants.setComponent(labelStyle, label);

document.insertString(document.getLength(), "Ignored", labelStyle);

JTextPane textPane = new JTextPane(document);