当前位置: 首页>>代码示例>>Java>>正文


Java TextAnchor类代码示例

本文整理汇总了Java中org.jfree.ui.TextAnchor的典型用法代码示例。如果您正苦于以下问题:Java TextAnchor类的具体用法?Java TextAnchor怎么用?Java TextAnchor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextAnchor类属于org.jfree.ui包,在下文中一共展示了TextAnchor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Marker

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Constructs a new marker.
 *
 * @param paint  the paint (<code>null</code> not permitted).
 * @param stroke  the stroke (<code>null</code> not permitted).
 * @param outlinePaint  the outline paint (<code>null</code> permitted).
 * @param outlineStroke  the outline stroke (<code>null</code> permitted).
 * @param alpha  the alpha transparency.
 */
public Marker(Paint paint, Stroke stroke, 
              Paint outlinePaint, Stroke outlineStroke, 
              float alpha) {

    if (paint == null) {
        throw new IllegalArgumentException("Null 'paint' argument.");
    }
    if (stroke == null) {
        throw new IllegalArgumentException("Null 'stroke' argument.");
    }
    
    this.paint = paint;
    this.stroke = stroke;
    this.outlinePaint = outlinePaint;
    this.outlineStroke = outlineStroke;
    this.alpha = alpha;
    
    this.labelFont = new Font("SansSerif", Font.PLAIN, 9);
    this.labelPaint = Color.black;
    this.labelAnchor = RectangleAnchor.TOP_LEFT;
    this.labelOffset = new RectangleInsets(UnitType.ABSOLUTE, 3.0, 3.0, 3.0, 3.0);
    this.labelTextAnchor = TextAnchor.CENTER;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:Marker.java

示例2: DialValueIndicator

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/** 
 * Creates a new instance of <code>DialValueIndicator</code>.
 * 
 * @param datasetIndex  the dataset index.
 * @param label  the label.
 */
public DialValueIndicator(int datasetIndex, String label) {
    this.datasetIndex = datasetIndex;
    this.angle = -90.0;
    this.radius = 0.3;
    this.frameAnchor = RectangleAnchor.CENTER;
    this.templateValue = new Double(100.0);
    this.formatter = new DecimalFormat("0.0");
    this.font = new Font("Dialog", Font.BOLD, 14);
    this.paint = Color.black;
    this.backgroundPaint = Color.white;
    this.outlineStroke = new BasicStroke(1.0f);
    this.outlinePaint = Color.blue;
    this.insets = new RectangleInsets(4, 4, 4, 4);
    this.valueAnchor = RectangleAnchor.RIGHT;
    this.textAnchor = TextAnchor.CENTER_RIGHT;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:DialValueIndicator.java

示例3: setLineRender

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) {
    plot.setNoDataMessage(NO_DATA_MSG);
    plot.setInsets(new RectangleInsets(10, 10, 0, 10), false);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();

    renderer.setStroke(new BasicStroke(1.5F));
    if (isShowDataLabels) {
        renderer.setBaseItemLabelsVisible(true);
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
                NumberFormat.getInstance()));
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
    }
    renderer.setBaseShapesVisible(isShapesVisible);
    setXAixs(plot);
    setYAixs(plot);

}
 
开发者ID:Fanping,项目名称:iveely.ml,代码行数:18,代码来源:ChartUtils.java

示例4: ItemLabelPosition

import org.jfree.ui.TextAnchor; //导入依赖的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 itemLabelAnchor  the item label anchor (<code>null</code> not 
 *                         permitted).
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not 
 *                        permitted).
 * @param angle  the rotation angle (in radians).
 */
public ItemLabelPosition(ItemLabelAnchor itemLabelAnchor, 
                         TextAnchor textAnchor,
                         TextAnchor rotationAnchor,
                         double angle) {
          
    if (itemLabelAnchor == null) {
        throw new IllegalArgumentException(
                "Null 'itemLabelAnchor' argument.");
    }
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException(
                "Null 'rotationAnchor' argument.");
    }
    
    this.itemLabelAnchor = itemLabelAnchor;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:ItemLabelPosition.java

示例5: BarRenderer3D

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Constructs a new renderer with the specified '3D effect'.
 *
 * @param xOffset  the x-offset for the 3D effect.
 * @param yOffset  the y-offset for the 3D effect.
 */
public BarRenderer3D(double xOffset, double yOffset) {

    super();
    this.xOffset = xOffset;
    this.yOffset = yOffset;
    this.wallPaint = DEFAULT_WALL_PAINT;
    // set the default item label positions
    ItemLabelPosition p1 = new ItemLabelPosition(
        ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER
    );
    setPositiveItemLabelPosition(p1);
    ItemLabelPosition p2 = new ItemLabelPosition(
        ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER
    );
    setNegativeItemLabelPosition(p2);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:BarRenderer3D.java

示例6: createDownRotationLabelPositions

import org.jfree.ui.TextAnchor; //导入依赖的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
    );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:CategoryLabelPositions.java

示例7: CategoryLabelPosition

import org.jfree.ui.TextAnchor; //导入依赖的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;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:CategoryLabelPosition.java

示例8: drawLegendTitle

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Draws the legend title.
 * 
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param legendTitle  the title (<code>null</code> permitted, in which case the method 
 *                     does nothing).
 */
private void drawLegendTitle(Graphics2D g2, DrawableLegendItem legendTitle) {
    if (legendTitle != null) {
        // XXX dsm - make title bold?
        g2.setPaint(legendTitle.getItem().getPaint());
        g2.setPaint(this.itemPaint);
        g2.setFont(getTitleFont());
        TextUtilities.drawAlignedString(
            legendTitle.getItem().getLabel(), g2,
            (float) legendTitle.getLabelPosition().getX(),
            (float) legendTitle.getLabelPosition().getY(), TextAnchor.CENTER_LEFT
        );
        LOGGER.debug("Title x = " + legendTitle.getLabelPosition().getX());
        LOGGER.debug("Title y = " + legendTitle.getLabelPosition().getY());
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:StandardLegend.java

示例9: ItemLabelPosition

import org.jfree.ui.TextAnchor; //导入依赖的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 itemLabelAnchor  the item label anchor (<code>null</code> not permitted).
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not permitted).
 * @param angle  the rotation angle (in radians).
 */
public ItemLabelPosition(ItemLabelAnchor itemLabelAnchor, 
                         TextAnchor textAnchor,
                         TextAnchor rotationAnchor,
                         double angle) {
          
    if (itemLabelAnchor == null) {
        throw new IllegalArgumentException("Null 'itemLabelAnchor' argument.");
    }
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException("Null 'rotationAnchor' argument.");
    }
    
    this.itemLabelAnchor = itemLabelAnchor;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:ItemLabelPosition.java

示例10: testGetSetLabelTextAnchor

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Some checks for the getLabelTextAnchor() and setLabelTextAnchor() 
 * methods.
 */
public void testGetSetLabelTextAnchor() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(TextAnchor.CENTER, m.getLabelTextAnchor());
    m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
    assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelTextAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:MarkerTests.java

示例11: testHashCode

import org.jfree.ui.TextAnchor; //导入依赖的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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:CategoryTickTests.java

示例12: BarRenderer3D

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Constructs a new renderer with the specified '3D effect'.
 *
 * @param xOffset  the x-offset for the 3D effect.
 * @param yOffset  the y-offset for the 3D effect.
 */
public BarRenderer3D(double xOffset, double yOffset) {

    super();
    this.xOffset = xOffset;
    this.yOffset = yOffset;
    this.wallPaint = DEFAULT_WALL_PAINT;
    // set the default item label positions
    ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, 
            TextAnchor.TOP_CENTER);
    setPositiveItemLabelPosition(p1);
    ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, 
            TextAnchor.TOP_CENTER);
    setNegativeItemLabelPosition(p2);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:BarRenderer3D.java

示例13: drawValueLabel

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Draws the value label just below the center of the dial.
 * 
 * @param g2  the graphics device.
 * @param area  the plot area.
 */
protected void drawValueLabel(Graphics2D g2, Rectangle2D area) {
    g2.setFont(this.valueFont);
    g2.setPaint(this.valuePaint);
    String valueStr = "No value";
    if (this.dataset != null) {
        Number n = this.dataset.getValue();
        if (n != null) {
            valueStr = this.tickLabelFormat.format(n.doubleValue()) + " " 
                     + this.units;
        }
    }
    float x = (float) area.getCenterX();
    float y = (float) area.getCenterY() + DEFAULT_CIRCLE_SIZE;
    TextUtilities.drawAlignedString(valueStr, g2, x, y, 
            TextAnchor.TOP_CENTER);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:MeterPlot.java

示例14: Tick

import org.jfree.ui.TextAnchor; //导入依赖的package包/类
/**
 * Creates a new tick.
 *
 * @param text  the formatted version of the tick value.
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not 
 *                        permitted).
 * @param angle  the angle. 
 */
public Tick(String text, TextAnchor textAnchor, TextAnchor rotationAnchor, 
            double angle) {
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException(
            "Null 'rotationAnchor' argument."
        );   
    }
    this.text = text;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:Tick.java

示例15: createUpRotationLabelPositions

import org.jfree.ui.TextAnchor; //导入依赖的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
    );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:CategoryLabelPositions.java


注:本文中的org.jfree.ui.TextAnchor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。