{
final WebPopOver colorChooser = new WebPopOver ( parentComponent );
colorChooser.setCloseOnFocusLoss ( true );
colorChooser.setStyleId ( "editor-pop-over" );
final WebColorChooserPanel colorChooserPanel = new WebColorChooserPanel ( false );
colorChooserPanel.setColor ( color != null ? color : Color.WHITE );
colorChooserPanel.addChangeListener ( new ChangeListener ()
{
private int length = content.getEnd () - content.getBegin ();
@Override
public void stateChanged ( final ChangeEvent e )
{
final Color newColor = colorChooserPanel.getColor ();
if ( color == null || newColor != null && !newColor.equals ( color ) )
{
final String colorString = colorConverter.toString ( newColor );
source.replaceRange ( colorString, content.getBegin (), content.getBegin () + length );
length = colorString.length ();