1 package nl.tudelft.simulation.introspection.mapping;
2
3 import java.awt.Component;
4
5 import javax.swing.AbstractCellEditor;
6 import javax.swing.JComponent;
7 import javax.swing.JPanel;
8 import javax.swing.JTable;
9 import javax.swing.table.TableCellEditor;
10
11 /***
12 * An editor for SwingComponents.
13 * <p>
14 * (c) copyright 2002-2005 <a href="http://www.simulation.tudelft.nl">Delft
15 * University of Technology </a>, the Netherlands. <br>
16 * See for project information <a
17 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
18 * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
19 * General Public License (LGPL) </a>, no warranty.
20 *
21 * @author <a href="http://www.peter-jacobs.com/index.htm">Peter Jacobs </a>
22 * @version 1.2 Apr 15, 2004
23 * @since 1.5
24 */
25 public class SwingCellEditor extends AbstractCellEditor implements
26 TableCellEditor
27 {
28 /*** the value to edit */
29 private JComponent value = new JPanel();
30
31 /***
32 * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(JTable,
33 * Object, boolean, int, int)
34 */
35 public Component getTableCellEditorComponent(final JTable table,
36 final Object value, final boolean isSelected, final int row,
37 final int column)
38 {
39 this.value = (JComponent) value;
40 return (JComponent) value;
41 }
42
43 /***
44 * @see javax.swing.CellEditor#getCellEditorValue()
45 */
46 public Object getCellEditorValue()
47 {
48 return this.value;
49 }
50 }