1 /*
   2  * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.swing.table;
  27 
  28 import java.awt.Component;
  29 import javax.swing.CellEditor;
  30 import javax.swing.*;
  31 
  32 /**
  33  * This interface defines the method any object that would like to be
  34  * an editor of values for components such as {@code JListBox},
  35  * {@code JComboBox}, {@code JTree}, or {@code JTable}
  36  * needs to implement.
  37  *
  38  * @author Alan Chung
  39  */
  40 
  41 
  42 public interface TableCellEditor extends CellEditor {
  43 
  44     /**
  45      *  Sets an initial {@code value} for the editor.  This will cause
  46      *  the editor to {@code stopEditing} and lose any partially
  47      *  edited value if the editor is editing when this method is called. <p>
  48      *
  49      *  Returns the component that should be added to the client's
  50      *  {@code Component} hierarchy.  Once installed in the client's
  51      *  hierarchy this component will then be able to draw and receive
  52      *  user input.
  53      *
  54      * @param   table           the {@code JTable} that is asking the
  55      *                          editor to edit; can be {@code null}
  56      * @param   value           the value of the cell to be edited; it is
  57      *                          up to the specific editor to interpret
  58      *                          and draw the value.  For example, if value is
  59      *                          the string "true", it could be rendered as a
  60      *                          string or it could be rendered as a check
  61      *                          box that is checked.  {@code null}
  62      *                          is a valid value
  63      * @param   isSelected      true if the cell is to be rendered with
  64      *                          highlighting
  65      * @param   row             the row of the cell being edited
  66      * @param   column          the column of the cell being edited
  67      * @return  the component for editing
  68      */
  69     Component getTableCellEditorComponent(JTable table, Object value,
  70                                           boolean isSelected,
  71                                           int row, int column);
  72 }
--- EOF ---