1. /*
  2. * @(#)TableCellRenderer.java 1.12 01/11/29
  3. *
  4. * Copyright 2002 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 methods any object that would like to be
  12. * a renderer for cell in a JTable.
  13. *
  14. * @version 1.12 11/29/01
  15. * @author Alan Chung
  16. */
  17. public interface TableCellRenderer {
  18. /**
  19. * This method is sent to the renderer by the drawing table to
  20. * configure the renderer appropriately before drawing. Return
  21. * the Component used for drawing.
  22. *
  23. * @param table the JTable that is asking the renderer to draw.
  24. * This parameter can be null.
  25. * @param value the value of the cell to be rendered. It is
  26. * up to the specific renderer to interpret
  27. * and draw the value. eg. if value is the
  28. * String "true", it could be rendered as a
  29. * string or it could be rendered as a check
  30. * box that is checked. null is a valid value.
  31. * @param isSelected true is the cell is to be renderer with
  32. * selection highlighting
  33. * @param row the row index of the cell being drawn. When
  34. * drawing the header the rowIndex is -1.
  35. * @param column the column index of the cell being drawn
  36. */
  37. Component getTableCellRendererComponent(JTable table, Object value,
  38. boolean isSelected, boolean hasFocus,
  39. int row, int column);
  40. }