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