1 19 package jcckit.graphic; 20 21 import jcckit.util.ConfigParameters; 22 23 import java.awt.Color ; 24 25 30 public class ShapeAttributes implements LineAttributes, FillAttributes { 31 32 public static final String FILL_COLOR_KEY = "fillColor", 33 LINE_COLOR_KEY = "lineColor", 34 LINE_THICKNESS_KEY = "lineThickness", 35 LINE_PATTERN_KEY = "linePattern"; 36 37 private final Color _fillColor; 38 private final Color _lineColor; 39 private final double _lineThickness; 40 private final double[] _linePattern; 41 42 65 public ShapeAttributes(ConfigParameters config) { 66 this(config.getColor(FILL_COLOR_KEY, null), 67 config.getColor(LINE_COLOR_KEY, null), 68 config.getDouble(LINE_THICKNESS_KEY, 0), 69 config.getDoubleArray(LINE_PATTERN_KEY, null)); 70 } 71 72 80 public ShapeAttributes(Color fillColor, Color lineColor, 81 double lineThickness, double[] linePattern) { 82 _fillColor = fillColor; 83 _lineColor = lineColor; 84 _lineThickness = Math.max(0, lineThickness); 85 _linePattern = linePattern; 86 } 87 88 public Color getFillColor() { 89 return _fillColor; 90 } 91 92 public Color getLineColor() { 93 return _lineColor; 94 } 95 96 public double getLineThickness() { 97 return _lineThickness; 98 } 99 100 public double[] getLinePattern() { 101 return _linePattern; 102 } 103 } 104 105 | Popular Tags |