1 /* 2 * @(#)TableCellRenderer.java 1.18 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package javax.swing.table; 9 10 import java.awt.Component; 11 import javax.swing.*; 12 13 /** 14 * This interface defines the method required by any object that 15 * would like to be a renderer for cells in a <code>JTable</code>. 16 * 17 * @version 1.18 12/19/03 18 * @author Alan Chung 19 */ 20 21 public interface TableCellRenderer { 22 23 /** 24 * Returns the component used for drawing the cell. This method is 25 * used to configure the renderer appropriately before drawing. 26 * 27 * @param table the <code>JTable</code> that is asking the 28 * renderer to draw; can be <code>null</code> 29 * @param value the value of the cell to be rendered. It is 30 * up to the specific renderer to interpret 31 * and draw the value. For example, if 32 * <code>value</code> 33 * is the string "true", it could be rendered as a 34 * string or it could be rendered as a check 35 * box that is checked. <code>null</code> is a 36 * valid value 37 * @param isSelected true if the cell is to be rendered with the 38 * selection highlighted; otherwise false 39 * @param hasFocus if true, render cell appropriately. For 40 * example, put a special border on the cell, if 41 * the cell can be edited, render in the color used 42 * to indicate editing 43 * @param row the row index of the cell being drawn. When 44 * drawing the header, the value of 45 * <code>row</code> is -1 46 * @param column the column index of the cell being drawn 47 */ 48 Component getTableCellRendererComponent(JTable table, Object value, 49 boolean isSelected, boolean hasFocus, 50 int row, int column); 51 } 52