org.tbee.swing.table
Class GenericEditor
java.lang.Object
javax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
org.tbee.swing.table.DefaultCellEditor
org.tbee.swing.table.GenericEditor
- All Implemented Interfaces:
- Serializable, CellEditor, TableCellEditor, TreeCellEditor
public class GenericEditor
- extends DefaultCellEditor
Extracted from javax.swing.JTable, but removed the border logic
This class uses toString and the string constructor of the column class (as returned by the table model) to render and parse the value.
This would create a number editor:
static class NumberEditor extends GenericEditor {
public NumberEditor() {
((JTextField)getComponent()).setHorizontalAlignment(JTextField.RIGHT);
}
}
And this a boolean editor:
static class BooleanEditor extends DefaultCellEditor {
public BooleanEditor() {
super(new JCheckBox());
JCheckBox checkBox = (JCheckBox)getComponent();
checkBox.setHorizontalAlignment(JCheckBox.CENTER);
}
}
- Author:
- user
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SOURCECODE_VERSION
public static final String SOURCECODE_VERSION
- Standard variable for determining version of a class file.
- See Also:
- Constant Field Values
iArgTypes
protected Class[] iArgTypes
iConstructor
protected Constructor iConstructor
iValue
protected Object iValue
GenericEditor
public GenericEditor()
stopCellEditing
public boolean stopCellEditing()
- Convert string to object using string constructor and return value
- Specified by:
stopCellEditing in interface CellEditor- Overrides:
stopCellEditing in class DefaultCellEditor
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
- Convert object to string and render
- Specified by:
getTableCellEditorComponent in interface TableCellEditor- Overrides:
getTableCellEditorComponent in class DefaultCellEditor
getCellEditorValue
public Object getCellEditorValue()
- Specified by:
getCellEditorValue in interface CellEditor- Overrides:
getCellEditorValue in class DefaultCellEditor
Copyright © 2011 KnowledgePlaza. All Rights Reserved.