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 2003 <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/gpl.html">General Public
19 * License (GPL) </a>, no warranty <br>
20 *
21 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
22 * Jacobs </a>
23 * @version 1.2 Apr 15, 2004
24 * @since 1.4
25 */
26 public class SwingCellEditor extends AbstractCellEditor implements
27 TableCellEditor
28 {
29 /*** the value to edit */
30 private JComponent value = new JPanel();
31
32 /***
33 * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(JTable,
34 * Object, boolean, int, int)
35 */
36 public Component getTableCellEditorComponent(final JTable table,
37 final Object value, final boolean isSelected, final int row,
38 final int column)
39 {
40 this.value = (JComponent) value;
41 return (JComponent) value;
42 }
43
44 /***
45 * @see javax.swing.CellEditor#getCellEditorValue()
46 */
47 public Object getCellEditorValue()
48 {
49 return this.value;
50 }
51 }