A box containing a text block.
| Method from org.jfree.text.TextBox Detail: |
public void draw(Graphics2D g2,
float x,
float y,
RectangleAnchor anchor) {
final Size2D d1 = this.textBlock.calculateDimensions(g2);
final double w = this.interiorGap.extendWidth(d1.getWidth());
final double h = this.interiorGap.extendHeight(d1.getHeight());
final Size2D d2 = new Size2D(w, h);
final Rectangle2D bounds
= RectangleAnchor.createRectangle(d2, x, y, anchor);
double xx = bounds.getX();
double yy = bounds.getY();
if (this.shadowPaint != null) {
final Rectangle2D shadow = new Rectangle2D.Double(
xx + this.shadowXOffset, yy + this.shadowYOffset,
bounds.getWidth(), bounds.getHeight());
g2.setPaint(this.shadowPaint);
g2.fill(shadow);
}
if (this.backgroundPaint != null) {
g2.setPaint(this.backgroundPaint);
g2.fill(bounds);
}
if (this.outlinePaint != null && this.outlineStroke != null) {
g2.setPaint(this.outlinePaint);
g2.setStroke(this.outlineStroke);
g2.draw(bounds);
}
this.textBlock.draw(g2,
(float) (xx + this.interiorGap.calculateLeftInset(w)),
(float) (yy + this.interiorGap.calculateTopInset(h)),
TextBlockAnchor.TOP_LEFT);
}
|
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof TextBox)) {
return false;
}
final TextBox that = (TextBox) obj;
if (!ObjectUtilities.equal(this.outlinePaint, that.outlinePaint)) {
return false;
}
if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) {
return false;
}
if (!ObjectUtilities.equal(this.interiorGap, that.interiorGap)) {
return false;
}
if (!ObjectUtilities.equal(this.backgroundPaint,
that.backgroundPaint)) {
return false;
}
if (!ObjectUtilities.equal(this.shadowPaint, that.shadowPaint)) {
return false;
}
if (this.shadowXOffset != that.shadowXOffset) {
return false;
}
if (this.shadowYOffset != that.shadowYOffset) {
return false;
}
if (!ObjectUtilities.equal(this.textBlock, that.textBlock)) {
return false;
}
return true;
}
Tests this object for equality with an arbitrary object. |
public Paint getBackgroundPaint() {
return this.backgroundPaint;
}
Returns the background paint. |
public double getHeight(Graphics2D g2) {
final Size2D d = this.textBlock.calculateDimensions(g2);
return this.interiorGap.extendHeight(d.getHeight());
}
Returns the height of the text box. |
public RectangleInsets getInteriorGap() {
return this.interiorGap;
}
Returns the interior gap. |
public Paint getOutlinePaint() {
return this.outlinePaint;
}
Returns the outline paint. |
public Stroke getOutlineStroke() {
return this.outlineStroke;
}
Returns the outline stroke. |
public Paint getShadowPaint() {
return this.shadowPaint;
}
Returns the shadow paint. |
public double getShadowXOffset() {
return this.shadowXOffset;
}
Returns the x-offset for the shadow effect. |
public double getShadowYOffset() {
return this.shadowYOffset;
}
Returns the y-offset for the shadow effect. |
public TextBlock getTextBlock() {
return this.textBlock;
}
|
public int hashCode() {
int result;
long temp;
result = (this.outlinePaint != null ? this.outlinePaint.hashCode() : 0);
result = 29 * result + (this.outlineStroke != null
? this.outlineStroke.hashCode() : 0);
result = 29 * result + (this.interiorGap != null
? this.interiorGap.hashCode() : 0);
result = 29 * result + (this.backgroundPaint != null
? this.backgroundPaint.hashCode() : 0);
result = 29 * result + (this.shadowPaint != null
? this.shadowPaint.hashCode() : 0);
temp = this.shadowXOffset != +0.0d
? Double.doubleToLongBits(this.shadowXOffset) : 0L;
result = 29 * result + (int) (temp ^ (temp > > > 32));
temp = this.shadowYOffset != +0.0d
? Double.doubleToLongBits(this.shadowYOffset) : 0L;
result = 29 * result + (int) (temp ^ (temp > > > 32));
result = 29 * result + (this.textBlock != null
? this.textBlock.hashCode() : 0);
return result;
}
Returns a hash code for this object. |
public void setBackgroundPaint(Paint paint) {
this.backgroundPaint = paint;
}
Sets the background paint. |
public void setInteriorGap(RectangleInsets gap) {
this.interiorGap = gap;
}
|
public void setOutlinePaint(Paint paint) {
this.outlinePaint = paint;
}
|
public void setOutlineStroke(Stroke stroke) {
this.outlineStroke = stroke;
}
|
public void setShadowPaint(Paint paint) {
this.shadowPaint = paint;
}
|
public void setShadowXOffset(double offset) {
this.shadowXOffset = offset;
}
Sets the x-offset for the shadow effect. |
public void setShadowYOffset(double offset) {
this.shadowYOffset = offset;
}
Sets the y-offset for the shadow effect. |
public void setTextBlock(TextBlock block) {
this.textBlock = block;
}
|