edu.jhu.tmaj.client.image.data
Class ButtonEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by edu.jhu.tmaj.client.image.data.ButtonEditor
All Implemented Interfaces:
java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor

public final class ButtonEditor
extends javax.swing.AbstractCellEditor
implements javax.swing.table.TableCellEditor

A TableCellEditor that displays a JButton. That is, when the user tries to edit the table by clicking on a cell, the editor will always return the same JButton. Additionally, the Object of the clicked cell can be retrieved with getCellEditorValue(). A JButton is passed into the constructor. This is so that you can add an ActionListener to the JButton that does something when it is clicked.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
ButtonEditor(javax.swing.JButton button)
           
 
Method Summary
 java.lang.Object getCellEditorValue()
          Returns the Object in the tableModel that was last selected for editing.
 java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
          Sets the current Object to value and returns the JButton.
 
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
 

Constructor Detail

ButtonEditor

public ButtonEditor(javax.swing.JButton button)
Method Detail

getCellEditorValue

public java.lang.Object getCellEditorValue()
Returns the Object in the tableModel that was last selected for editing.

Specified by:
getCellEditorValue in interface javax.swing.CellEditor

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                      java.lang.Object value,
                                                      boolean isSelected,
                                                      int row,
                                                      int column)
Sets the current Object to value and returns the JButton. This method is called whenever the user starts to edit the table, which happens when the user clicks on a cell.

Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor