class AbstractColorPropertyEditor extends PropertyEditorSupport {

    protected String toText(String mode, Color color) {<FILL_FUNCTION_BODY>}

    protected Color toColor(String text) {
        Pattern p = Pattern.compile("\\w+\\s*\\[\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,?(\\d+)?\\s*\\]");
        Matcher m = p.matcher(text);
        if (m.lookingAt()) {
            int r = Integer.valueOf(m.group(1));
            int g = Integer.valueOf(m.group(2));
            int b = Integer.valueOf(m.group(3));
            String alpha = m.group(4);
            if (alpha != null) {
                int a = Integer.valueOf(alpha);
                return new Color(r, g, b, a);
            } else {
                return new Color(r, g, b);
            }
        }
        return Color.BLACK;
    }

    protected boolean matchColorMode(String s, String identifier) {
        String regexp = String.format("\\s*%s\\s*", identifier);
        Pattern p = Pattern.compile(regexp);
        Matcher m = p.matcher(s);
        return m.lookingAt();
    }
}

        if (color.getAlpha() < 255) {
            return String.format(
                "%s [%d,%d,%d,%d]",
                mode.toLowerCase(),
                color.getRed(),
                color.getGreen(),
                color.getBlue(),
                color.getAlpha());
        } else {
            return String.format(
                "%s [%d,%d,%d]",
                mode.toLowerCase(),
                color.getRed(),
                color.getGreen(),
                color.getBlue());
        }
    
<methods>public void <init>() ,public void <init>(java.lang.Object) ,public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener) ,public void firePropertyChange() ,public java.lang.String getAsText() ,public java.awt.Component getCustomEditor() ,public java.lang.String getJavaInitializationString() ,public java.lang.Object getSource() ,public java.lang.String[] getTags() ,public java.lang.Object getValue() ,public boolean isPaintable() ,public void paintValue(java.awt.Graphics, java.awt.Rectangle) ,public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener) ,public void setAsText(java.lang.String) throws java.lang.IllegalArgumentException,public void setSource(java.lang.Object) ,public void setValue(java.lang.Object) ,public boolean supportsCustomEditor() <variables>private Vector<java.beans.PropertyChangeListener> listeners,private java.lang.Object source,private java.lang.Object value