package nl.tudelft.simulation.introspection.mapping; import java.awt.Component; import javax.swing.AbstractCellEditor; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.table.TableCellEditor; /** * An editor for SwingComponents. *
* (c) copyright 2002-2014 Delft University of Technology.
* BSD-style license. See DSOL License.
* @author Peter Jacobs.
* @author Alexander Verbraeck.
* @author Niels Lang.
* @since 1.5
*/
public class SwingCellEditor extends AbstractCellEditor implements TableCellEditor
{
/** */
private static final long serialVersionUID = 20140831L;
/** the value to edit. */
private JComponent component = new JPanel();
/** {@inheritDoc} */
@Override
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected,
final int row, final int column)
{
this.component = (JComponent) value;
return (JComponent) value;
}
/** {@inheritDoc} */
@Override
public Object getCellEditorValue()
{
return this.component;
}
}