public class TimeTableEditor extends AbstractCellEditor implements TableCellEditor, TableCellRenderer
// Usage example:
// Create a table.
JTable table = new JTable();
//Set up a renderer and editor for the LocalTime type.
table.setDefaultRenderer(LocalTime.class, new TimeTableEditor());
table.setDefaultEditor(LocalTime.class, new TimeTableEditor());
The TimePicker and TimePickerSettings: The time picker and picker settings can be accessed with
the supplied getter functions. Note that most of the settings for the time picker are left at
their default values, but a few (mostly cosmetic) settings are changed in the TimeTableEditor
constructor. See the TimeTableEditor constructor implementation to learn which default settings
were changed.
Auto adjust row height: By default, this class will automatically adjust the minimum height of
all table rows. This occurs during the first time that any cell with an editor or render is
displayed. The row height is only adjusted if the current table row height value is below the
minimum value that is needed to display the time picker component. This auto adjust behavior can
be turned off from the TimeTableEditor constructor.Modifier and Type | Field and Description |
---|---|
int |
clickCountToEdit
clickCountToEdit, An integer specifying the number of clicks needed to start editing.
|
changeEvent, listenerList
Constructor and Description |
---|
TimeTableEditor()
Constructor, default.
|
TimeTableEditor(boolean autoAdjustMinimumTableRowHeight,
boolean matchTableBackgroundColor,
boolean matchTableSelectionBackgroundColor)
Constructor, with options.
|
Modifier and Type | Method and Description |
---|---|
Object |
getCellEditorValue()
getCellEditorValue, This returns the value contained in the editor.
|
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
getTableCellEditorComponent, this returns the editor that is used for editing the cell.
|
Component |
getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
getTableCellRendererComponent, Returns the renderer that is used for drawing the cell.
|
TimePicker |
getTimePicker()
getTimePicker, Returns the TimePicker which is used by this class.
|
TimePickerSettings |
getTimePickerSettings()
getTimePickerSettings, Returns the TimePickerSettings for the TimePicker being used by this
class.
|
boolean |
isCellEditable(EventObject anEvent)
isCellEditable, Returns true if anEvent is not a MouseEvent.
|
void |
setCellEditorValue(Object value)
setCellEditorValue, This sets the picker to an appropriate value for the supplied object.
|
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener, shouldSelectCell, stopCellEditing
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addCellEditorListener, cancelCellEditing, removeCellEditorListener, shouldSelectCell, stopCellEditing
public int clickCountToEdit
public TimeTableEditor()
public TimeTableEditor(boolean autoAdjustMinimumTableRowHeight, boolean matchTableBackgroundColor, boolean matchTableSelectionBackgroundColor)
autoAdjustMinimumTableRowHeight
- Set this to true to have this class automatically
adjust the the minimum row height of all rows in the table, the first time that a
TimeTableEditor is displayed. Set this to false to turn off any row height adjustments. The
default value is true.public Object getCellEditorValue()
getCellEditorValue
in interface CellEditor
public TimePicker getTimePicker()
public TimePickerSettings getTimePickerSettings()
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
getTableCellEditorComponent
in interface TableCellEditor
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
getTableCellRendererComponent
in interface TableCellRenderer
public boolean isCellEditable(EventObject anEvent)
isCellEditable
in interface CellEditor
isCellEditable
in class AbstractCellEditor
public void setCellEditorValue(Object value)
Copyright © 2017. All rights reserved.