I m试图展示能够显示但只能展示最后的icon的JEditorpane im的立案率。 我想在新的一条线上对每一条单行表示和展示吗?
String fileList[] = {".pdf", ".txt", ".doc", ".exe"}
JLabel label;
FileSystemView fsv = FileSystemView.getFileSystemView();
icon = fsv.getSystemIcon(File.createTempFile("file.", "." + filetype[i]));
label = new JLabel(icon);
StyleContext context = new StyleContext();
StyledDocument document = new DefaultStyledDocument(context);
Style labelStyle = context.getStyle(StyleContext.DEFAULT_STYLE);
StyleConstants.setComponent(labelStyle, label);
try {
document.insertString(document.getLength(), "
", labelStyle);
} catch (BadLocationException badLocationException) {
System.err.println("Oops");
}
myjEditorPane.setDocument(document);