I am trying to create a list where thumbnails are shown for a jEditorPane - similar to how in powerpoint you can see a preview of each slide. However, for some reason the images and backgrounds in my editorpane are rendered but the text is not. Some example code:
private void createThumbNailView(javax.swing.event.TreeSelectionEvent evt) {
JEditorPane test = new JEditorPane();
JScrollPane jsp = new JScrollPane();
test.setEditorKit(edkit);
test.setText("TEST TEXT - THIS WILL NOT BE RENDERED");
test.setMargin(new java.awt.Insets(30, 30, 30, 60));
jsp.setViewportView(test);
BufferedImage bi = new BufferedImage(300,250,BufferedImage.TYPE_INT_RGB);
test.paint(bi.getGraphics());
jLabel1.setIcon(new ImageIcon(bi));
}
I have found that if I use a jEditorPane that is created by Netbeans into the GUI, then the text rendering DOES work. However, if I create a new one (as shown in the code above) with the base constructor, then the text does not render. This makes me think that there is something in the layout or some preparatory code that I need to include for the text to get rendered. Any help at all is appreciated!