本文整理汇总了Java中org.jfree.text.TextBlockAnchor.CENTER属性的典型用法代码示例。如果您正苦于以下问题:Java TextBlockAnchor.CENTER属性的具体用法?Java TextBlockAnchor.CENTER怎么用?Java TextBlockAnchor.CENTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.text.TextBlockAnchor
的用法示例。
在下文中一共展示了TextBlockAnchor.CENTER属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
/**
* 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);
}
示例2: testHashCode
/**
* 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);
}
示例3: testHashCode
/**
* 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);
}
示例4: testHashCode
/**
* 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);
}
示例5: testHashCode
/**
* 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);
}
示例6: testCloning
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
CategoryTick t1 = new CategoryTick("C1", new TextBlock(),
TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f);
CategoryTick t2 = (CategoryTick) t1.clone();
assertTrue(t1 != t2);
assertTrue(t1.getClass() == t2.getClass());
assertTrue(t1.equals(t2));
}
示例7: testSerialization
/**
* Serialize an instance, restore it, and check for equality.
*/
@Test
public void testSerialization() {
CategoryTick t1 = new CategoryTick("C1", new TextBlock(),
TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f);
CategoryTick t2 = (CategoryTick) TestUtilities.serialised(t1);
assertEquals(t1, t2);
}
示例8: LabelBlock
/**
* Creates a new label block.
*
* @param text the text for the label (<code>null</code> not permitted).
* @param font the font (<code>null</code> not permitted).
* @param paint the paint (<code>null</code> not permitted).
*/
public LabelBlock(String text, Font font, Paint paint) {
this.text = text;
this.paint = paint;
this.label = TextUtilities.createTextBlock(text, font, this.paint);
this.font = font;
this.toolTipText = null;
this.urlText = null;
this.contentAlignmentPoint = TextBlockAnchor.CENTER;
this.textAnchor = RectangleAnchor.CENTER;
}
示例9: testEquals
/**
* Check that the equals() method can distinguish all fields.
*/
@Test
public void testEquals() {
CategoryLabelPosition p1 = new CategoryLabelPosition(
RectangleAnchor.BOTTOM_LEFT, TextBlockAnchor.CENTER_RIGHT,
TextAnchor.BASELINE_LEFT, Math.PI / 4.0,
CategoryLabelWidthType.RANGE, 0.44f);
CategoryLabelPosition p2 = new CategoryLabelPosition(
RectangleAnchor.BOTTOM_LEFT, TextBlockAnchor.CENTER_RIGHT,
TextAnchor.BASELINE_LEFT, Math.PI / 4.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertTrue(p1.equals(p2));
assertTrue(p2.equals(p1));
p1 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER_RIGHT, TextAnchor.BASELINE_LEFT,
Math.PI / 4.0, CategoryLabelWidthType.RANGE, 0.44f);
assertFalse(p1.equals(p2));
p2 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER_RIGHT, TextAnchor.BASELINE_LEFT,
Math.PI / 4.0, CategoryLabelWidthType.RANGE, 0.44f);
assertTrue(p1.equals(p2));
p1 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.BASELINE_LEFT, Math.PI / 4.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertFalse(p1.equals(p2));
p2 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.BASELINE_LEFT, Math.PI / 4.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertTrue(p1.equals(p2));
p1 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 4.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertFalse(p1.equals(p2));
p2 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 4.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertTrue(p1.equals(p2));
p1 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 6.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertFalse(p1.equals(p2));
p2 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 6.0,
CategoryLabelWidthType.RANGE, 0.44f);
assertTrue(p1.equals(p2));
p1 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 6.0,
CategoryLabelWidthType.CATEGORY, 0.44f);
assertFalse(p1.equals(p2));
p2 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 6.0,
CategoryLabelWidthType.CATEGORY, 0.44f);
assertTrue(p1.equals(p2));
p1 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 6.0,
CategoryLabelWidthType.CATEGORY, 0.55f);
assertFalse(p1.equals(p2));
p2 = new CategoryLabelPosition(RectangleAnchor.TOP,
TextBlockAnchor.CENTER, TextAnchor.CENTER, Math.PI / 6.0,
CategoryLabelWidthType.CATEGORY, 0.55f);
assertTrue(p1.equals(p2));
}
示例10: testEquals
/**
* Confirm that the equals method can distinguish all the required fields.
*/
@Test
public void testEquals() {
Comparable c1 = "C1";
Comparable c2 = "C2";
TextBlock tb1 = new TextBlock();
tb1.addLine(new TextLine("Block 1"));
TextBlock tb2 = new TextBlock();
tb1.addLine(new TextLine("Block 2"));
TextBlockAnchor tba1 = TextBlockAnchor.CENTER;
TextBlockAnchor tba2 = TextBlockAnchor.BOTTOM_CENTER;
TextAnchor ta1 = TextAnchor.CENTER;
TextAnchor ta2 = TextAnchor.BASELINE_LEFT;
CategoryTick t1 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
CategoryTick t2 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
assertTrue(t1.equals(t2));
t1 = new CategoryTick(c2, tb1, tba1, ta1, 1.0f);
assertFalse(t1.equals(t2));
t2 = new CategoryTick(c2, tb1, tba1, ta1, 1.0f);
assertTrue(t1.equals(t2));
t1 = new CategoryTick(c2, tb2, tba1, ta1, 1.0f);
assertFalse(t1.equals(t2));
t2 = new CategoryTick(c2, tb2, tba1, ta1, 1.0f);
assertTrue(t1.equals(t2));
t1 = new CategoryTick(c2, tb2, tba2, ta1, 1.0f);
assertFalse(t1.equals(t2));
t2 = new CategoryTick(c2, tb2, tba2, ta1, 1.0f);
assertTrue(t1.equals(t2));
t1 = new CategoryTick(c2, tb2, tba2, ta2, 1.0f);
assertFalse(t1.equals(t2));
t2 = new CategoryTick(c2, tb2, tba2, ta2, 1.0f);
assertTrue(t1.equals(t2));
t1 = new CategoryTick(c2, tb2, tba2, ta2, 2.0f);
assertFalse(t1.equals(t2));
t2 = new CategoryTick(c2, tb2, tba2, ta2, 2.0f);
assertTrue(t1.equals(t2));
}