01 /*
02 * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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</code>,
35 * <code>JComboBox</code>, <code>JTree</code>, or <code>JTable</code>
36 * needs to implement.
37 *
38 * @version 1.23 05/05/07
39 * @author Alan Chung
40 */
41
42 public interface TableCellEditor extends CellEditor {
43
44 /**
45 * Sets an initial <code>value</code> for the editor. This will cause
46 * the editor to <code>stopEditing</code> 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</code> 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</code> that is asking the
55 * editor to edit; can be <code>null</code>
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</code>
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, int row, int column);
71 }
|