In addition to custom renderers, you can also create custom
editors for your table cells. (Actually, the basic stuff in this section
also applies to the
JTree class.) You
have several options ranging from straightforward to completely
This interface governs the basic functionality required of an editor. It has methods for retrieving a new value and determining when to start and stop editing. The basic process for editing is:
The user clicks the required number of times on the cell (varies from editor to editor).
The component (usually
JTable) replaces the cell with its
The user types or chooses a new value.
The user ends the editing session (e.g., pressing Enter in a text field).
The editor fires a change event to interested listeners (usually the tree or table containing the cell), stating that editing is finished.
The component reads the new value and replaces the editor with the cell’s renderer.
interface requires methods for adding and removing cell editor
listeners, which are objects interested in finding out whether
editing is finished or canceled. The
CellEditorListener class is discussed
later in the chapter.
Access the only property of a cell editor, which is the cell’s current value. After successful editing, a table or ...