1 42 43 package org.jfree.xml.parser.coretypes; 44 45 import java.awt.Color ; 46 47 import org.jfree.xml.parser.AbstractXmlReadHandler; 48 import org.xml.sax.Attributes ; 49 import org.xml.sax.SAXException ; 50 51 54 public class ColorReadHandler extends AbstractXmlReadHandler { 55 56 57 private Color color; 58 59 62 public ColorReadHandler() { 63 super(); 64 } 65 66 74 protected void startParsing(final Attributes attrs) throws SAXException { 75 final String encodedValue = attrs.getValue("value"); 76 this.color = Color.decode(encodedValue); 77 if (attrs.getValue("alpha") != null) { 78 this.color = new Color (this.color.getRed(), this.color.getGreen(), 79 this.color.getBlue(), 80 Integer.parseInt(attrs.getValue("alpha"))); 81 } 82 } 83 84 89 public Object getObject() { 90 return this.color; 91 } 92 93 } 94 | Popular Tags |