1 22 23 24 package net.sourceforge.chart2d; 25 26 27 import java.awt.*; 28 29 30 38 final class LegendArea extends VerticalTextListArea { 39 40 41 private boolean needsUpdate; 42 43 44 51 LegendArea() { 52 53 setAutoSizes (false, false); 54 setAutoJustifys (false, false); 55 resetLegendAreaModel (true); 56 needsUpdate = true; 57 } 58 59 60 66 final void setColors (Color[] colors) { 67 68 needsUpdate = true; 69 setBulletColors (colors); 70 } 71 72 73 85 final void resetLegendAreaModel (boolean reset) { 86 87 needsUpdate = true; 88 resetVerticalTextListAreaModel (reset); 89 } 90 91 92 96 final boolean getLegendAreaNeedsUpdate() { 97 98 return (needsUpdate || getVerticalTextListAreaNeedsUpdate()); 99 } 100 101 102 107 final void updateLegendArea (Graphics2D g2D) { 108 if (getLegendAreaNeedsUpdate()) { 109 updateVerticalTextListArea (g2D); 110 } 111 needsUpdate = false; 112 } 113 114 115 119 void paintComponent (Graphics2D g2D) { 120 121 updateLegendArea (g2D); 122 super.paintComponent (g2D); 123 } 124 } | Popular Tags |