net.sf.freecol.client.gui.panel
Class ColorCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by net.sf.freecol.client.gui.panel.ColorCellEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener, javax.swing.CellEditor, javax.swing.table.TableCellEditor

public final class ColorCellEditor
extends javax.swing.AbstractCellEditor
implements javax.swing.table.TableCellEditor, java.awt.event.ActionListener

A table cell editor that can be used to edit colors.

See Also:
Serialized Form

Nested Class Summary
private  class ColorCellEditor.ColorChooserPanel
          This class represents a panel that holds a JColorChooser and OK and cancel buttons.
 
Field Summary
private static java.lang.String CANCEL
           
private  Canvas canvas
           
private  javax.swing.JColorChooser colorChooser
           
private  ColorCellEditor.ColorChooserPanel colorChooserPanel
           
private  javax.swing.JButton colorEditButton
           
private  java.awt.Color currentColor
           
private static java.lang.String EDIT
           
private static java.util.logging.Logger logger
           
private static java.lang.String OK
           
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
ColorCellEditor(Canvas canvas)
          The constructor to use.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          This function analyzes an event and calls the right methods to take care of the user's requests.
 java.lang.Object getCellEditorValue()
          Returns the value of the cell editor.
 java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean hasFocus, int row, int column)
          Returns the component used to edit the cell's value.
 
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

logger

private static final java.util.logging.Logger logger

EDIT

private static final java.lang.String EDIT
See Also:
Constant Field Values

OK

private static final java.lang.String OK
See Also:
Constant Field Values

CANCEL

private static final java.lang.String CANCEL
See Also:
Constant Field Values

colorEditButton

private final javax.swing.JButton colorEditButton

colorChooser

private final javax.swing.JColorChooser colorChooser

colorChooserPanel

private final ColorCellEditor.ColorChooserPanel colorChooserPanel

canvas

private final Canvas canvas

currentColor

private java.awt.Color currentColor
Constructor Detail

ColorCellEditor

public ColorCellEditor(Canvas canvas)
The constructor to use.

Parameters:
canvas - The top level component that holds all other components.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
This function analyzes an event and calls the right methods to take care of the user's requests.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The incoming ActionEvent.

getTableCellEditorComponent

public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                      java.lang.Object value,
                                                      boolean hasFocus,
                                                      int row,
                                                      int column)
Returns the component used to edit the cell's value.

Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
Parameters:
table - The table whose cell needs to be edited.
value - The value of the cell being edited.
hasFocus - Indicates whether or not the cell in question has focus.
row - The row index of the cell that is being edited.
column - The column index of the cell that is being edited.
Returns:
The component used to edit the cell's value.

getCellEditorValue

public java.lang.Object getCellEditorValue()
Returns the value of the cell editor.

Specified by:
getCellEditorValue in interface javax.swing.CellEditor
Returns:
The value of the cell editor.