uk.ac.ic.doc.automed.editor
Class CheckBoxEditor
java.lang.Object
javax.swing.AbstractCellEditor
uk.ac.ic.doc.automed.editor.CheckBoxEditor
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor
public class CheckBoxEditor
- extends javax.swing.AbstractCellEditor
- implements javax.swing.table.TableCellEditor
Cell editor class for cache table. This class uses a combination of a
TextArea
and a JScrollPane
to construct a flexible scrollable text box that
appears whenever a cell's value is too long to fit in a table's column
To use this class, all you need to do is to initialise a JTable
object
and invoke the following method:
myTable.setDefaultEditor(Object.class, new TextEditor(myTable));
if you would like to use the same editor for all columns. Alternatively,
you could use myColumn.setCellEditor(new TextEditor(myTable))
to
use the editor for a specific table column.
- Author:
- Duc M Le dmle@doc.ic.ac.uk
- See Also:
- Serialized Form
Field Summary |
private javax.swing.JCheckBox |
_chkEditor
|
private javax.swing.JTable |
_table
|
Fields inherited from class javax.swing.AbstractCellEditor |
changeEvent, listenerList |
Method Summary |
void |
addItemListener(java.awt.event.ItemListener il)
|
static int |
calculateCellValueLength(java.awt.Component c,
java.lang.String value)
Get the estimated length of a text string painted on a component |
java.lang.Object |
getCellEditorValue()
Implement one method of AbstractCellEditor adapter class |
protected java.lang.String |
getSelectedValue(javax.swing.JTable table)
Get the selected cell value |
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Implement TableCellEditor interface.
Return the actual text editor to use in the selected table cell. |
Methods inherited from class javax.swing.AbstractCellEditor |
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.CellEditor |
addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing |
_chkEditor
private javax.swing.JCheckBox _chkEditor
_table
private javax.swing.JTable _table
CheckBoxEditor
public CheckBoxEditor()
CheckBoxEditor
public CheckBoxEditor(boolean defaultState,
javax.swing.JTable table)
addItemListener
public void addItemListener(java.awt.event.ItemListener il)
getCellEditorValue
public java.lang.Object getCellEditorValue()
- Implement one method of
AbstractCellEditor
adapter class
- Specified by:
getCellEditorValue
in interface javax.swing.CellEditor
getTableCellEditorComponent
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
- Implement
TableCellEditor
interface.
Return the actual text editor to use in the selected table cell.
- Specified by:
getTableCellEditorComponent
in interface javax.swing.table.TableCellEditor
getSelectedValue
protected java.lang.String getSelectedValue(javax.swing.JTable table)
- Get the selected cell value
calculateCellValueLength
public static int calculateCellValueLength(java.awt.Component c,
java.lang.String value)
- Get the estimated length of a text string painted on a component