package etomica.graphics;
import java.awt.Color;

import etomica.atom.Atom;

/**
 * Class that defines the algorithm used to determine atoms colors when drawn to DisplayPhase.
 * The atomColor method is called just before the atom is drawn to set the graphics color.
 *
 * @author David Kofke
 */
 
public abstract class ColorScheme implements java.io.Serializable {

    protected Color baseColor;
    
    public ColorScheme() {
        this(DEFAULT_ATOM_COLOR);
    }
    public ColorScheme(Color color) {
        baseColor = color;
    }
    
    public abstract Color atomColor(Atom a);
    
    public final void setBaseColor(Color c) {baseColor = c;}
    public final Color getBaseColor() {return baseColor;}

    public static Color DEFAULT_ATOM_COLOR;
    
    static {
        try {
            DEFAULT_ATOM_COLOR = Color.BLACK;
        } catch(NoSuchFieldError e) {//in case java 1.3, which doesn't like caps
            DEFAULT_ATOM_COLOR = Color.black;
        }
    }
    /**
     * Colors all atoms with baseColor.
     */
    public static class Simple extends ColorScheme {
        public Simple() {super();}
        public Simple(java.awt.Color color) {super(color);}
        public Color atomColor(Atom a) {return baseColor;}
    }//end of Simple
}//end of ColorScheme

@@ -738,199 +738,8 @@
 lor 
-DEFAULT_ATOM_COLOR;%0A    %0A    static %7B%0A        try %7B%0A            DEFAULT_ATOM_COLOR = Color.BLACK;%0A        %7D catch(NoSuchFieldError e) %7B//in case java 1.3, which doesn't like caps%0A            
 DEFA
@@ -776,19 +776,8 @@
     
-    %7D%0A    %7D
 %0A   

use lower-case color name for backwards compatibility