Package jmri.util.table
Class ButtonEditor
java.lang.Object
jmri.util.table.BasicCellEditor
jmri.util.table.ButtonEditor
- All Implemented Interfaces:
ActionListener,PropertyChangeListener,EventListener,CellEditor,TableCellEditor,JmriMouseListener
public class ButtonEditor
extends BasicCellEditor
implements ActionListener, TableCellEditor, JmriMouseListener
Make a JButton in a table cell function.
Works with ButtonRenderer.
This was adapted from Core Swing Advanced Programming, Prentice Hall
Changes: Remove DataWithIcon reference. Change package
This also now implements and registers as a MouseListener, so you can change the mouse-event behavior by overriding the needed methods.
-
Field Summary
FieldsFields 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) voidInvoked when the mouse button has been clicked (pressed and released) on a component.voidInvoked when the mouse enters a component.voidInvoked when the mouse exits a component.voidInvoked when a mouse button has been pressed on a component.voidInvoked when a mouse button has been released on a component.voidsetBackground(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
-
value
-
foreground
-
background
-
font
-
-
Constructor Details
-
ButtonEditor
-
-
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
Description copied from interface:JmriMouseListenerInvoked when a mouse button has been pressed on a component.- Specified by:
mousePressedin interfaceJmriMouseListener- Parameters:
e- the event to be processed
-
mouseExited
Description copied from interface:JmriMouseListenerInvoked when the mouse exits a component.- Specified by:
mouseExitedin interfaceJmriMouseListener- Parameters:
e- the event to be processed
-
mouseEntered
Description copied from interface:JmriMouseListenerInvoked when the mouse enters a component.- Specified by:
mouseEnteredin interfaceJmriMouseListener- Parameters:
e- the event to be processed
-
mouseReleased
Description copied from interface:JmriMouseListenerInvoked when a mouse button has been released on a component.- Specified by:
mouseReleasedin interfaceJmriMouseListener- Parameters:
e- the event to be processed
-
mouseClicked
Description copied from interface:JmriMouseListenerInvoked when the mouse button has been clicked (pressed and released) on a component.- Specified by:
mouseClickedin interfaceJmriMouseListener- Parameters:
e- the event to be processed
-