本文整理汇总了Java中org.jfree.text.TextBlockAnchor类的典型用法代码示例。如果您正苦于以下问题:Java TextBlockAnchor类的具体用法?Java TextBlockAnchor怎么用?Java TextBlockAnchor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextBlockAnchor类属于org.jfree.text包,在下文中一共展示了TextBlockAnchor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawNoDataMessage
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Draws a message to state that there is no data to plot.
*
* @param g2 the graphics device.
* @param area the area within which the plot should be drawn.
*/
protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area) {
Shape savedClip = g2.getClip();
g2.clip(area);
String message = this.noDataMessage;
if (message != null) {
g2.setFont(this.noDataMessageFont);
g2.setPaint(this.noDataMessagePaint);
// FontMetrics fm = g2.getFontMetrics(this.noDataMessageFont);
// Rectangle2D bounds = TextUtilities.getTextBounds(message, g2, fm);
// float x = (float) (area.getX() + area.getWidth() / 2 - bounds.getWidth() / 2);
// float y = (float) (area.getMinY() + (area.getHeight() / 2) - (bounds.getHeight() / 2));
// g2.drawString(message, x, y);
TextBlock block = TextUtilities.createTextBlock(
this.noDataMessage, this.noDataMessageFont, this.noDataMessagePaint,
0.9f * (float) area.getWidth(), new G2TextMeasurer(g2)
);
block.draw(
g2, (float) area.getCenterX(), (float) area.getCenterY(), TextBlockAnchor.CENTER
);
}
g2.setClip(savedClip);
}
示例2: testEquals
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Problem equals method.
*/
public void testEquals() {
CategoryLabelPositions p1 = new CategoryLabelPositions(
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER)
);
CategoryLabelPositions p2 = new CategoryLabelPositions(
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER)
);
assertEquals(p1, p2);
}
示例3: createUpRotationLabelPositions
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new instance where the category labels angled upwards by the specified amount.
*
* @param angle the rotation angle (should be < Math.PI / 2.0).
*
* @return A category label position specification.
*/
public static CategoryLabelPositions createUpRotationLabelPositions(double angle) {
return new CategoryLabelPositions(
new CategoryLabelPosition(
RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT,
TextAnchor.BOTTOM_LEFT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
), // TOP
new CategoryLabelPosition(
RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT,
TextAnchor.TOP_RIGHT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
), // BOTTOM
new CategoryLabelPosition(
RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT,
TextAnchor.BOTTOM_RIGHT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
), // LEFT
new CategoryLabelPosition(
RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT,
TextAnchor.TOP_LEFT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
) // RIGHT
);
}
示例4: createDownRotationLabelPositions
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new instance where the category labels angled downwards by the specified amount.
*
* @param angle the rotation angle (should be < Math.PI / 2.0).
*
* @return A category label position specification.
*/
public static CategoryLabelPositions createDownRotationLabelPositions(double angle) {
return new CategoryLabelPositions(
new CategoryLabelPosition(
RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT,
TextAnchor.BOTTOM_RIGHT, angle,
CategoryLabelWidthType.RANGE, 0.50f
), // TOP
new CategoryLabelPosition(
RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT,
TextAnchor.TOP_LEFT, angle,
CategoryLabelWidthType.RANGE, 0.50f
), // BOTTOM
new CategoryLabelPosition(
RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT,
TextAnchor.TOP_RIGHT, angle,
CategoryLabelWidthType.RANGE, 0.50f
), // LEFT
new CategoryLabelPosition(
RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT,
TextAnchor.BOTTOM_LEFT, angle,
CategoryLabelWidthType.RANGE, 0.50f
) // RIGHT
);
}
示例5: CategoryLabelPosition
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new position record. The item label anchor is a point relative to the
* data item (dot, bar or other visual item) on a chart. The item label is aligned
* by aligning the text anchor with the item label anchor.
*
* @param categoryAnchor the category anchor (<code>null</code> not permitted).
* @param labelAnchor the label anchor (<code>null</code> not permitted).
* @param rotationAnchor the rotation anchor (<code>null</code> not permitted).
* @param angle the rotation angle (<code>null</code> not permitted).
*
* @deprecated Use alternative constructor.
*/
public CategoryLabelPosition(RectangleAnchor categoryAnchor,
TextBlockAnchor labelAnchor,
TextAnchor rotationAnchor,
double angle) {
if (categoryAnchor == null) {
throw new IllegalArgumentException("Null 'categoryAnchor' argument.");
}
if (labelAnchor == null) {
throw new IllegalArgumentException("Null 'labelAnchor' argument.");
}
if (rotationAnchor == null) {
throw new IllegalArgumentException("Null 'rotationAnchor' argument.");
}
this.categoryAnchor = categoryAnchor;
this.labelAnchor = labelAnchor;
this.rotationAnchor = rotationAnchor;
this.angle = angle;
this.widthType = CategoryLabelWidthType.CATEGORY;
this.widthRatio = 0.90f;
}
示例6: testHashCode
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
Comparable c1 = "C1";
TextBlock tb1 = new TextBlock();
tb1.addLine(new TextLine("Block 1"));
tb1.addLine(new TextLine("Block 2"));
TextBlockAnchor tba1 = TextBlockAnchor.CENTER;
TextAnchor ta1 = TextAnchor.CENTER;
CategoryTick t1 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
CategoryTick t2 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
assertTrue(t1.equals(t2));
int h1 = t1.hashCode();
int h2 = t2.hashCode();
assertEquals(h1, h2);
}
示例7: testHashCode
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
CategoryLabelPositions p1 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER)
);
CategoryLabelPositions p2 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER)
);
assertTrue(p1.equals(p2));
int h1 = p1.hashCode();
int h2 = p2.hashCode();
assertEquals(h1, h2);
}
示例8: drawNoDataMessage
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Draws a message to state that there is no data to plot.
*
* @param g2 the graphics device.
* @param area the area within which the plot should be drawn.
*/
protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area) {
Shape savedClip = g2.getClip();
g2.clip(area);
String message = this.noDataMessage;
if (message != null) {
g2.setFont(this.noDataMessageFont);
g2.setPaint(this.noDataMessagePaint);
TextBlock block = TextUtilities.createTextBlock(
this.noDataMessage, this.noDataMessageFont,
this.noDataMessagePaint, 0.9f * (float) area.getWidth(),
new G2TextMeasurer(g2));
block.draw(g2, (float) area.getCenterX(), (float) area.getCenterY(),
TextBlockAnchor.CENTER);
}
g2.setClip(savedClip);
}
示例9: createUpRotationLabelPositions
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new instance where the category labels angled upwards by the
* specified amount.
*
* @param angle the rotation angle (should be < Math.PI / 2.0).
*
* @return A category label position specification.
*/
public static CategoryLabelPositions createUpRotationLabelPositions(
double angle) {
return new CategoryLabelPositions(
new CategoryLabelPosition(
RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT,
TextAnchor.BOTTOM_LEFT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
), // TOP
new CategoryLabelPosition(
RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT,
TextAnchor.TOP_RIGHT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
), // BOTTOM
new CategoryLabelPosition(
RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT,
TextAnchor.BOTTOM_RIGHT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
), // LEFT
new CategoryLabelPosition(
RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT,
TextAnchor.TOP_LEFT, -angle,
CategoryLabelWidthType.RANGE, 0.50f
) // RIGHT
);
}
示例10: createDownRotationLabelPositions
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new instance where the category labels angled downwards by the
* specified amount.
*
* @param angle the rotation angle (should be < Math.PI / 2.0).
*
* @return A category label position specification.
*/
public static CategoryLabelPositions createDownRotationLabelPositions(
double angle) {
return new CategoryLabelPositions(
new CategoryLabelPosition(
RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT,
TextAnchor.BOTTOM_RIGHT, angle,
CategoryLabelWidthType.RANGE, 0.50f
), // TOP
new CategoryLabelPosition(
RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT,
TextAnchor.TOP_LEFT, angle,
CategoryLabelWidthType.RANGE, 0.50f
), // BOTTOM
new CategoryLabelPosition(
RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT,
TextAnchor.TOP_RIGHT, angle,
CategoryLabelWidthType.RANGE, 0.50f
), // LEFT
new CategoryLabelPosition(
RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT,
TextAnchor.BOTTOM_LEFT, angle,
CategoryLabelWidthType.RANGE, 0.50f
) // RIGHT
);
}
示例11: testHashCode
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
@Test
public void testHashCode() {
CategoryLabelPositions p1 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
CategoryLabelPositions p2 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
assertTrue(p1.equals(p2));
int h1 = p1.hashCode();
int h2 = p2.hashCode();
assertEquals(h1, h2);
}
示例12: testHashCode
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
@Test
public void testHashCode() {
Comparable c1 = "C1";
TextBlock tb1 = new TextBlock();
tb1.addLine(new TextLine("Block 1"));
tb1.addLine(new TextLine("Block 2"));
TextBlockAnchor tba1 = TextBlockAnchor.CENTER;
TextAnchor ta1 = TextAnchor.CENTER;
CategoryTick t1 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
CategoryTick t2 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
assertTrue(t1.equals(t2));
int h1 = t1.hashCode();
int h2 = t2.hashCode();
assertEquals(h1, h2);
}
示例13: drawNoDataMessage
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Draws a message to state that there is no data to plot.
*
* @param g2 the graphics device.
* @param area the area within which the plot should be drawn.
*/
protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area) {
Shape savedClip = g2.getClip();
g2.clip(area);
String message = this.noDataMessage;
if (message != null) {
g2.setFont(this.noDataMessageFont);
g2.setPaint(this.noDataMessagePaint);
TextBlock block = TextUtilities.createTextBlock(
this.noDataMessage, this.noDataMessageFont,
this.noDataMessagePaint, 0.9f * (float) area.getWidth(),
new G2TextMeasurer(g2));
block.draw(g2, (float) area.getCenterX(),
(float) area.getCenterY(), TextBlockAnchor.CENTER);
}
g2.setClip(savedClip);
}
示例14: createUpRotationLabelPositions
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new instance where the category labels angled upwards by the
* specified amount.
*
* @param angle the rotation angle (should be < Math.PI / 2.0).
*
* @return A category label position specification.
*/
public static CategoryLabelPositions createUpRotationLabelPositions(
double angle) {
return new CategoryLabelPositions(
new CategoryLabelPosition(
RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT,
TextAnchor.BOTTOM_LEFT, -angle,
CategoryLabelWidthType.RANGE, 0.50f), // TOP
new CategoryLabelPosition(
RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT,
TextAnchor.TOP_RIGHT, -angle,
CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM
new CategoryLabelPosition(
RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT,
TextAnchor.BOTTOM_RIGHT, -angle,
CategoryLabelWidthType.RANGE, 0.50f), // LEFT
new CategoryLabelPosition(
RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT,
TextAnchor.TOP_LEFT, -angle,
CategoryLabelWidthType.RANGE, 0.50f) // RIGHT
);
}
示例15: createDownRotationLabelPositions
import org.jfree.text.TextBlockAnchor; //导入依赖的package包/类
/**
* Creates a new instance where the category labels angled downwards by the
* specified amount.
*
* @param angle the rotation angle (should be < Math.PI / 2.0).
*
* @return A category label position specification.
*/
public static CategoryLabelPositions createDownRotationLabelPositions(
double angle) {
return new CategoryLabelPositions(
new CategoryLabelPosition(
RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT,
TextAnchor.BOTTOM_RIGHT, angle,
CategoryLabelWidthType.RANGE, 0.50f), // TOP
new CategoryLabelPosition(
RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT,
TextAnchor.TOP_LEFT, angle,
CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM
new CategoryLabelPosition(
RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT,
TextAnchor.TOP_RIGHT, angle,
CategoryLabelWidthType.RANGE, 0.50f), // LEFT
new CategoryLabelPosition(
RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT,
TextAnchor.BOTTOM_LEFT, angle,
CategoryLabelWidthType.RANGE, 0.50f) // RIGHT
);
}