1 27 package org.objectweb.clif.console.lib.gui; 28 29 import java.awt.Component ; 30 31 import javax.swing.JTable ; 32 import javax.swing.table.DefaultTableCellRenderer ; 33 34 public class GraphCellRenderer extends DefaultTableCellRenderer { 35 36 private InjectorsGraph[] allInjectors; 37 38 public GraphCellRenderer(InjectorsGraph[] allInjectors) { 39 this.allInjectors = allInjectors; 40 } 41 42 public Component getTableCellRendererComponent( 43 JTable table, 44 Object value, 45 boolean isSelected, 46 boolean hasFocus, 47 int row, 48 int column) { 49 super.getTableCellRendererComponent( 50 table, 51 value, 52 isSelected, 53 hasFocus, 54 row, 55 column); 56 for (int i = 0; i < allInjectors.length; i++) { 57 if (allInjectors[i].name.equals((String ) value)) { 58 this.setForeground(allInjectors[i].color); 59 break; 60 } 61 } 62 63 return this; 64 } 65 } | Popular Tags |