1. /*
  2. * @(#)TableCellEditor.java 1.15 03/01/23
  3. *
  4. * Copyright 2003 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.CellEditor;
  10. import javax.swing.*;
  11. /**
  12. * This interface defines the method any object that would like to be
  13. * an editor of values for components such as <code>JListBox</code>,
  14. * <code>JComboBox</code>, <code>JTree</code>, or <code>JTable</code>
  15. * needs to implement.
  16. *
  17. * @version 1.15 01/23/03
  18. * @author Alan Chung
  19. */
  20. public interface TableCellEditor extends CellEditor {
  21. /**
  22. * Sets an initial <code>value</code> for the editor. This will cause
  23. * the editor to <code>stopEditing</code> and lose any partially
  24. * edited value if the editor is editing when this method is called. <p>
  25. *
  26. * Returns the component that should be added to the client's
  27. * <code>Component</code> hierarchy. Once installed in the client's
  28. * hierarchy this component will then be able to draw and receive
  29. * user input.
  30. *
  31. * @param table the <code>JTable</code> that is asking the
  32. * editor to edit; can be <code>null</code>
  33. * @param value the value of the cell to be edited; it is
  34. * up to the specific editor to interpret
  35. * and draw the value. For example, if value is
  36. * the string "true", it could be rendered as a
  37. * string or it could be rendered as a check
  38. * box that is checked. <code>null</code>
  39. * is a valid value
  40. * @param isSelected true if the cell is to be rendered with
  41. * highlighting
  42. * @param row the row of the cell being edited
  43. * @param column the column of the cell being edited
  44. * @return the component for editing
  45. */
  46. Component getTableCellEditorComponent(JTable table, Object value,
  47. boolean isSelected,
  48. int row, int column);
  49. }