Package jmri.util.table
Class ToggleButtonEditor
java.lang.Object
jmri.util.table.BasicCellEditor
jmri.util.table.ToggleButtonEditor
- All Implemented Interfaces:
ActionListener,MouseListener,PropertyChangeListener,EventListener,CellEditor,TableCellEditor
public class ToggleButtonEditor
extends BasicCellEditor
implements ActionListener, TableCellEditor, MouseListener
Make a JToggleButton in a table cell function. Used eg. in OBlock tables for units
Works with ToggleButtonRenderer.
Adapted from ButtonRenderer
This also now implements and registers as a MouseListener, so you can change the mouse-event behavior by overriding the needed methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Colorprotected Fontprotected Colorprotected Stringprotected Stringprotected ObjectFields inherited from class jmri.util.table.BasicCellEditor
changeEvent, editingEvent, editor, listeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoideditingStarted(EventObject event) getTableCellEditorComponent(JTable tbl, Object value, boolean isSelected, int row, int column) voidvoidvoidvoidvoidvoidsetBackground(Color background) voidvoidsetForeground(Color foreground) protected voidMethods inherited from class jmri.util.table.BasicCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getComponent, getEditingEvent, isCellEditable, propertyChange, removeCellEditorListener, setComponent, shouldSelectCell, stopCellEditingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.swing.CellEditor
addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
-
Field Details
-
onText
-
offText
-
value
-
foreground
-
background
-
font
-
-
Constructor Details
-
ToggleButtonEditor
-
-
Method Details
-
setForeground
-
setBackground
-
setFont
-
getCellEditorValue
- Specified by:
getCellEditorValuein interfaceCellEditor- Overrides:
getCellEditorValuein classBasicCellEditor
-
editingStarted
- Overrides:
editingStartedin classBasicCellEditor
-
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable tbl, Object value, boolean isSelected, int row, int column) - Specified by:
getTableCellEditorComponentin interfaceTableCellEditor
-
setValue
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-