public void actionPerformed(ActionEvent e){
  if (EDIT.equals(e.getActionCommand())) {
    button.setBackground(currentColor);
    colorChooser.setColor(currentColor);
    dialog.setVisible(true);
    fireEditingStopped();
  }
 else {
    currentColor=colorChooser.getColor();
  }
}

public void actionPerformed ( ActionEvent e ) { if ( EDIT . equals ( e . getActionCommand ( ) ) ) { button . setBackground ( currentColor ) ; colorChooser . setColor ( currentColor ) ; dialog . setVisible ( true ) ; fireEditingStopped ( ) ; } else { currentColor = colorChooser . getColor ( ) ; } }
handles events from the editor button and from the dialog ' s ok button .
