View Javadoc

1   package nl.tudelft.simulation.introspection.mapping;
2   
3   import java.awt.Color;
4   import java.awt.Component;
5   import java.util.EventObject;
6   
7   import javax.swing.JPanel;
8   import javax.swing.JTable;
9   import javax.swing.event.CellEditorListener;
10  import javax.swing.table.TableCellEditor;
11  
12  
13  /***
14   * An editor for TableObjects.
15   * <p>
16   * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
17   * University of Technology </a>, the Netherlands. <br>
18   * See for project information <a
19   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
20   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
21   * License (GPL) </a>, no warranty <br>
22   * 
23   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
24   *         Jacobs </a>
25   * @version 1.2 Apr 15, 2004
26   * @since 1.4
27   */
28  public class MyTableCellEditor implements TableCellEditor
29  {
30  	/***
31  	 * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(JTable,
32  	 *      Object, boolean, int, int)
33  	 */
34  	public Component getTableCellEditorComponent(final JTable table,
35  			final Object value, final boolean isSelected, final int row,
36  			final int column)
37  	{
38  		JPanel result = new JPanel();
39  		result.setBackground(Color.YELLOW);
40  		return result;
41  	}
42  
43  	/***
44  	 * @see javax.swing.CellEditor#getCellEditorValue()
45  	 */
46  	public Object getCellEditorValue()
47  	{
48  		return null;
49  	}
50  
51  	/***
52  	 * @see javax.swing.CellEditor#isCellEditable(EventObject)
53  	 */
54  	public boolean isCellEditable(final EventObject anEvent)
55  	{
56  		return false;
57  	}
58  
59  	/***
60  	 * @see javax.swing.CellEditor#shouldSelectCell(EventObject)
61  	 */
62  	public boolean shouldSelectCell(final EventObject anEvent)
63  	{
64  		return false;
65  	}
66  
67  	/***
68  	 * @see javax.swing.CellEditor#stopCellEditing()
69  	 */
70  	public boolean stopCellEditing()
71  	{
72  		return false;
73  	}
74  
75  	/***
76  	 * @see javax.swing.CellEditor#cancelCellEditing()
77  	 */
78  	public void cancelCellEditing()
79  	{
80  		//We cannot edit; this method will never be invoked.
81  	}
82  
83  	/***
84  	 * @see javax.swing.CellEditor#addCellEditorListener(CellEditorListener)
85  	 */
86  	public void addCellEditorListener(final CellEditorListener l)
87  	{
88  		//Strange, we do not edit
89  	}
90  
91  	/***
92  	 * @see javax.swing.CellEditor#removeCellEditorListener(CellEditorListener)
93  	 */
94  	public void removeCellEditorListener(final CellEditorListener l)
95  	{
96  		//Same story
97  	}
98  }