Class ButtonColumn
java.lang.Object
javax.swing.AbstractCellEditor
org.openstreetmap.josm.gui.widgets.ButtonColumn
- All Implemented Interfaces:
ActionListener,Serializable,EventListener,CellEditor,TableCellEditor,TableCellRenderer
public class ButtonColumn
extends AbstractCellEditor
implements TableCellRenderer, TableCellEditor, ActionListener
Class based on: http://www.camick.com/java/source/ButtonColumn.java
https://tips4java.wordpress.com/2009/07/12/table-button-column/
- Since:
- 10536
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Actionprivate Stringprivate final JButtonprivate Objectprivate final JButtonFields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList -
Constructor Summary
ConstructorsConstructorDescriptionCreates a column that is rendered as a button with no action bound to the click eventButtonColumn(Action action) Creates a column that is rendered as a buttonButtonColumn(Action action, String buttonName) Constructs a newButtonColumn. -
Method Summary
Modifier and TypeMethodDescriptionvoidgetTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, 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
-
action
-
renderButton
-
editButton
-
editorValue
-
buttonName
-
-
Constructor Details
-
ButtonColumn
public ButtonColumn()Creates a column that is rendered as a button with no action bound to the click event -
ButtonColumn
Constructs a newButtonColumn.- Parameters:
action- actionbuttonName- button name
-
ButtonColumn
Creates a column that is rendered as a button- Parameters:
action- action to be performed when button is pressed
-
-
Method Details
-
getCellEditorValue
- Specified by:
getCellEditorValuein interfaceCellEditor
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) - Specified by:
getTableCellEditorComponentin interfaceTableCellEditor
-
getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) - Specified by:
getTableCellRendererComponentin interfaceTableCellRenderer
-