1 23 24 package de.laures.cewolf.taglib.tags; 25 26 import java.awt.Color ; 27 28 29 33 public class GradientTag extends CewolfTag implements Pointed { 34 35 private SerializableGradientPaint gPaint = new SerializableGradientPaint(); 36 private int pointCount = 0; 37 38 public int doStartTag() { 39 return EVAL_PAGE; 40 } 41 42 public int doEndTag() { 43 ((Painted)getParent()).setPaint(gPaint); 44 return doAfterEndTag(EVAL_PAGE); 45 } 46 47 public void reset() { 48 gPaint = new SerializableGradientPaint(); 49 pointCount = 0; 50 } 51 52 public void addPoint(int x, int y, Color c) { 53 switch (pointCount) { 54 case 0: 55 gPaint.setPoint1(x, y, c); 56 break; 57 default: 58 gPaint.setPoint2(x, y, c); 59 } 60 pointCount ++; 61 } 62 63 67 public void setCyclic(boolean cyclic) { 68 gPaint.setCyclic(cyclic); 69 } 70 71 } 72 | Popular Tags |