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