1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-22 07:48:52 -05:00

* improved CRC32 highlighting

This commit is contained in:
Reinhard Pointner 2008-10-06 20:15:43 +00:00
parent aefc84085b
commit 1ad60f8e97

View File

@ -15,16 +15,11 @@ class FileNameTableCellRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
if (hasFocus) {
// do not highlight checksum patterns in focused cells, that would look weird
return this;
}
// change font-color of checksum pattern
String htmlText = value.toString().replaceAll("\\[(\\p{XDigit}{8})\\]", "[<font color='#009900'>$1</font>]");
// 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})\\]", "[<span style='font-size: smaller;" + (!isSelected ? "color: #009900;" : "") + "'>$1</span>]");
// use no-break, because we really don't want line-wrapping in our table cells
setText("<html><nobr>" + htmlText + "</nobr></html>");