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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Action
action
private String
buttonName
private JButton
editButton
private Object
editorValue
private JButton
renderButton
-
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
-
-
Constructor Summary
Constructors Constructor Description ButtonColumn()
Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(ActionEvent e)
Object
getCellEditorValue()
Component
getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
Component
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, stopCellEditing
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
-
-
-
-
Field Detail
-
renderButton
private final JButton renderButton
-
editButton
private final JButton editButton
-
editorValue
private Object editorValue
-
buttonName
private String buttonName
-
-
Constructor Detail
-
ButtonColumn
public ButtonColumn()
Creates a column that is rendered as a button with no action bound to the click event
-
ButtonColumn
public ButtonColumn(Action action, String buttonName)
Constructs a newButtonColumn
.- Parameters:
action
- actionbuttonName
- button name
-
ButtonColumn
public ButtonColumn(Action action)
Creates a column that is rendered as a button- Parameters:
action
- action to be performed when button is pressed
-
-
Method Detail
-
getCellEditorValue
public Object getCellEditorValue()
- Specified by:
getCellEditorValue
in interfaceCellEditor
-
actionPerformed
public void actionPerformed(ActionEvent e)
- Specified by:
actionPerformed
in interfaceActionListener
-
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
- Specified by:
getTableCellEditorComponent
in interfaceTableCellEditor
-
getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
- Specified by:
getTableCellRendererComponent
in interfaceTableCellRenderer
-
-