1 32 33 package it.businesslogic.ireport.plugin.locale; 34 35 import it.businesslogic.ireport.plugin.locale.ResourceKey; 36 import java.awt.Color ; 37 import java.awt.Component ; 38 import javax.swing.JLabel ; 39 import javax.swing.JTable ; 40 import javax.swing.table.TableCellRenderer ; 41 42 46 public class MissingResourceCellRenderer extends JLabel implements TableCellRenderer { 47 48 49 public MissingResourceCellRenderer() { 50 super(); 51 52 } 53 54 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 55 56 boolean isMissing = false; 57 if (value instanceof ResourceKey) 58 { 59 ResourceKey rk = (ResourceKey)value; 60 isMissing = rk.isMissing(); 61 } 62 if (!isSelected) { 63 setForeground(((isMissing) ? Color.RED : table.getSelectionForeground())); 64 setBackground(table.getSelectionBackground()); 65 } else { 66 setForeground(((isMissing) ? Color.RED : table.getForeground())); 67 setBackground(table.getBackground()); 68 } 69 70 if (value == null) setText(""); 71 else setText(""+value); 72 this.updateUI(); 73 return this; 74 } 75 76 } 77 | Popular Tags |