I m trying to display System icons for file extention of JEditorpane i m able to display but only last icon get displayed ?I want to append and display each icon on newline?
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(), "\n", labelStyle);
} catch (BadLocationException badLocationException) {
System.err.println("Oops");
}
myjEditorPane.setDocument(document);