JComponent (@NotNull Charset charset, @Nullable Boolean bom) { String text = charset.displayName(); if (bom != null && bom) { text = DiffBundle.message("diff.utf.charset.name.bom.suffix", text); } JLabel label = new JLabel(text); // TODO: specific colors for other charsets if (charset.equals(StandardCharsets.UTF_8)) { label.setForeground(JBColor.BLUE); } else if (charset.equals(StandardCharsets.ISO_8859_1)) { label.setForeground(JBColor.RED); } else { label.setForeground(JBColor.BLACK); } return label; }