/**
 * A colorful scribble applet
 */

import java.applet.*;
import java.awt.*;

public class ColorScribble extends Scribble {
    
    // Get the back- and foreground colors from the HTML parameters
    public void init() {
        super.init();
        Color foreground = getColorParameter("foreground");
        Color background = getColorParameter("background");
        if (foreground != null) this.setForeground(foreground);
        if (background != null) this.setBackground(background);
    }
    
    // Get a color from the web parameter
    protected Color getColorParameter(String name) {
        String value = this.getParameter(name);
        try { return new Color(Integer.parseInt(value, 16)); }
        catch (Exception e) { return null; }
    }
    
    // For the About box
    public String getAppletInfo() {
        return "ColorScribble, based of off code by David Flanagan and written by a host of others.";
    }
      
    // This describes the applet parameters
    public String[][] getParameterInfo() { return info; }
    
    // This is the actual help, describing what the parameters are
    private String[][] info = {
        {"foreground", "hexadecimal color value", "foreground color"},
        {"background", "hexadecimal color value", "background color"}
    };
}

