diff --git a/source/net/sourceforge/filebot/ui/panel/sfv/FileNameTableCellRenderer.java b/source/net/sourceforge/filebot/ui/panel/sfv/HighlightPatternCellRenderer.java
similarity index 57%
rename from source/net/sourceforge/filebot/ui/panel/sfv/FileNameTableCellRenderer.java
rename to source/net/sourceforge/filebot/ui/panel/sfv/HighlightPatternCellRenderer.java
index f37b5666..b31400cb 100644
--- a/source/net/sourceforge/filebot/ui/panel/sfv/FileNameTableCellRenderer.java
+++ b/source/net/sourceforge/filebot/ui/panel/sfv/HighlightPatternCellRenderer.java
@@ -9,17 +9,29 @@ import javax.swing.table.DefaultTableCellRenderer;
/**
- * DefaultTableCellRenderer that will highlight CRC32 patterns.
+ * DefaultTableCellRenderer with highlighting of text patterns.
*/
-class FileNameTableCellRenderer extends DefaultTableCellRenderer {
+class HighlightPatternCellRenderer extends DefaultTableCellRenderer {
+ private final String pattern;
+ private final String cssColor;
+ private final String cssFontSize;
+
+
+ public HighlightPatternCellRenderer(String pattern, String cssColor, String cssFontSize) {
+ this.pattern = pattern;
+ this.cssColor = cssColor;
+ this.cssFontSize = cssFontSize;
+ }
+
+
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
// highlight CRC32 checksum patterns by using a smaller font-size and changing the font-color to a dark green
// do not change the font-color if cell is selected, because that would look ugly (imagine green text on blue background ...)
- String htmlText = value.toString().replaceAll("\\[(\\p{XDigit}{8})\\]", "[$1]");
+ String htmlText = value.toString().replaceAll(pattern, "[$1]");
// use no-break, because we really don't want line-wrapping in our table cells
setText("" + htmlText + "");
diff --git a/source/net/sourceforge/filebot/ui/panel/sfv/SfvTable.java b/source/net/sourceforge/filebot/ui/panel/sfv/SfvTable.java
index 208da7c6..dc51e1c7 100644
--- a/source/net/sourceforge/filebot/ui/panel/sfv/SfvTable.java
+++ b/source/net/sourceforge/filebot/ui/panel/sfv/SfvTable.java
@@ -44,7 +44,8 @@ class SfvTable extends JTable {
setUI(new DragDropRowTableUI());
- setDefaultRenderer(String.class, new FileNameTableCellRenderer());
+ // highlight CRC32 patterns in filenames in green and with smaller font-size
+ setDefaultRenderer(String.class, new HighlightPatternCellRenderer("\\[(\\p{XDigit}{8})\\]", "#009900", "smaller"));
setDefaultRenderer(ChecksumRow.State.class, new StateIconTableCellRenderer());
setDefaultRenderer(Checksum.class, new ChecksumTableCellRenderer());
}