?? pieplot.java
字號:
*
* @param section the section index (zero-based).
* @param paint the paint (<code>null</code> permitted).
*/
public void setSectionPaint(int section, Paint paint) {
this.sectionPaintList.setPaint(section, paint);
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the base section paint. This is used when no other paint is
* available.
*
* @return The paint (never <code>null</code>).
*/
public Paint getBaseSectionPaint() {
return this.baseSectionPaint;
}
/**
* Sets the base section paint.
*
* @param paint the paint (<code>null</code> not permitted).
*/
public void setBaseSectionPaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.baseSectionPaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
//// SECTION OUTLINE PAINT ////////////////////////////////////////////////
/**
* Returns the flag that controls whether or not the outline is drawn for
* each pie section.
*
* @return The flag that controls whether or not the outline is drawn for
* each pie section.
*/
public boolean getSectionOutlinesVisible() {
return this.sectionOutlinesVisible;
}
/**
* Sets the flag that controls whether or not the outline is drawn for
* each pie section, and sends a {@link PlotChangeEvent} to all registered
* listeners.
*
* @param visible the flag.
*/
public void setSectionOutlinesVisible(boolean visible) {
this.sectionOutlinesVisible = visible;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the outline paint for ALL sections in the plot.
*
* @return The paint (possibly <code>null</code>).
*/
public Paint getSectionOutlinePaint() {
return this.sectionOutlinePaint;
}
/**
* Sets the outline paint for ALL sections in the plot. If this is set to
* </code>null</code>, then a list of paints is used instead (to allow
* different colors to be used for each section).
*
* @param paint the paint (<code>null</code> permitted).
*/
public void setSectionOutlinePaint(Paint paint) {
this.sectionOutlinePaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the paint for the specified section.
*
* @param section the section index (zero-based).
*
* @return The paint (never <code>null</code>).
*/
public Paint getSectionOutlinePaint(int section) {
// return the override, if there is one...
if (this.sectionOutlinePaint != null) {
return this.sectionOutlinePaint;
}
// otherwise look up the paint list
Paint result = this.sectionOutlinePaintList.getPaint(section);
if (result == null) {
result = this.baseSectionOutlinePaint;
}
return result;
}
/**
* Sets the paint used to fill a section of the pie and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param section the section index (zero-based).
* @param paint the paint (<code>null</code> permitted).
*/
public void setSectionOutlinePaint(int section, Paint paint) {
this.sectionOutlinePaintList.setPaint(section, paint);
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the base section paint. This is used when no other paint is
* available.
*
* @return The paint (never <code>null</code>).
*/
public Paint getBaseSectionOutlinePaint() {
return this.baseSectionOutlinePaint;
}
/**
* Sets the base section paint.
*
* @param paint the paint (<code>null</code> not permitted).
*/
public void setBaseSectionOutlinePaint(Paint paint) {
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.baseSectionOutlinePaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
//// SECTION OUTLINE STROKE ///////////////////////////////////////////////
/**
* Returns the outline stroke for ALL sections in the plot.
*
* @return The stroke (possibly <code>null</code>).
*/
public Stroke getSectionOutlineStroke() {
return this.sectionOutlineStroke;
}
/**
* Sets the outline stroke for ALL sections in the plot. If this is set to
* </code>null</code>, then a list of paints is used instead (to allow
* different colors to be used for each section).
*
* @param stroke the stroke (<code>null</code> permitted).
*/
public void setSectionOutlineStroke(Stroke stroke) {
this.sectionOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the stroke for the specified section.
*
* @param section the section index (zero-based).
*
* @return The stroke (never <code>null</code>).
*/
public Stroke getSectionOutlineStroke(int section) {
// return the override, if there is one...
if (this.sectionOutlineStroke != null) {
return this.sectionOutlineStroke;
}
// otherwise look up the paint list
Stroke result = this.sectionOutlineStrokeList.getStroke(section);
if (result == null) {
result = this.baseSectionOutlineStroke;
}
return result;
}
/**
* Sets the stroke used to fill a section of the pie and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param section the section index (zero-based).
* @param stroke the stroke (<code>null</code> permitted).
*/
public void setSectionOutlineStroke(int section, Stroke stroke) {
this.sectionOutlineStrokeList.setStroke(section, stroke);
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the base section stroke. This is used when no other stroke is
* available.
*
* @return The stroke (never <code>null</code>).
*/
public Stroke getBaseSectionOutlineStroke() {
return this.baseSectionOutlineStroke;
}
/**
* Sets the base section stroke.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setBaseSectionOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.baseSectionOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the shadow paint.
*
* @return The paint (possibly <code>null</code>).
*/
public Paint getShadowPaint() {
return this.shadowPaint;
}
/**
* Sets the shadow paint and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @param paint the paint (<code>null</code> permitted).
*/
public void setShadowPaint(Paint paint) {
this.shadowPaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the x-offset for the shadow effect.
*
* @return The offset (in Java2D units).
*/
public double getShadowXOffset() {
return this.shadowXOffset;
}
* Sets the x-offset for the shadow effect and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param offset the offset (in Java2D units).
*/
public void setShadowXOffset(double offset) {
this.shadowXOffset = offset;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the y-offset for the shadow effect.
*
* @return The offset (in Java2D units).
*/
public double getShadowYOffset() {
return this.shadowYOffset;
}
/**
* Sets the y-offset for the shadow effect and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param offset the offset (in Java2D units).
*/
public void setShadowYOffset(double offset) {
this.shadowYOffset = offset;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the amount that a section should be 'exploded'.
*
* @param section the section number.
*
* @return The amount that a section should be 'exploded'.
*/
public double getExplodePercent(int section) {
double result = 0.0;
if (this.explodePercentages != null) {
Number percent = (Number) this.explodePercentages.get(section);
if (percent != null) {
result = percent.doubleValue();
}
}
return result;
}
/**
* Sets the amount that a pie section should be exploded and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
* @param section the section index.
* @param percent the explode percentage (0.30 = 30 percent).
*/
public void setExplodePercent(int section, double percent) {
if (this.explodePercentages == null) {
this.explodePercentages = new ObjectList();
}
this.explodePercentages.set(section, new Double(percent));
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the maximum explode percent.
*
* @return The percent.
*/
public double getMaximumExplodePercent() {
double result = 0.0;
for (int i = 0; i < this.explodePercentages.size(); i++) {
Number explode = (Number) this.explodePercentages.get(i);
if (explode != null) {
result = Math.max(result, explode.doubleValue());
}
}
return result;
}
/**
* Returns the section label generator.
*
* @return The generator (possibly <code>null</code>).
*/
public PieSectionLabelGenerator getLabelGenerator() {
return this.labelGenerator;
}
/**
* Sets the section label generator and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param generator the generator (<code>null</code> permitted).
*/
public void setLabelGenerator(PieSectionLabelGenerator generator) {
this.labelGenerator = generator;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the gap between the edge of the pie and the labels, expressed as
* a percentage of the plot width.
*
* @return The gap (a percentage, where 0.05 = five percent).
*/
public double getLabelGap() {
return this.labelGap;
}
/**
* Sets the gap between the edge of the pie and the labels (expressed as a
* percentage of the plot width) and sends a {@link PlotChangeEvent} to all
* registered listeners.
*
* @param gap the gap (a percentage, where 0.05 = five percent).
*/
public void setLabelGap(double gap) {
this.labelGap = gap;
notifyListeners(new PlotChangeEvent(this));
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -