Package org.jfree.text

Examples of org.jfree.text.TextBlock


        for (int i = 0; i < keys.getItemCount(); i++) {
            String label = this.labelGenerator.generateSectionLabel(
                    this.dataset, keys.getKey(i));

            if (label != null) {
                TextBlock block = TextUtilities.createTextBlock(label,
                        this.labelFont, this.labelPaint, maxLabelWidth,
                        new G2TextMeasurer(g2));
                TextBox labelBox = new TextBox(block);
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
                labelBox.setOutlinePaint(this.labelOutlinePaint);
View Full Code Here


     */
    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;
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        CategoryTick t1 = new CategoryTick(
            "C1", new TextBlock(), TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f
        );
        CategoryTick t2 = null;
        try {
            t2 = (CategoryTick) t1.clone();
        }
View Full Code Here

     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        CategoryTick t1 = new CategoryTick(
                "C1", new TextBlock(), TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f
            );
        CategoryTick t2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
View Full Code Here

                }
                Rectangle2D area = new Rectangle2D.Double(x0, y0, (x1 - x0), (y1 - y0));
                double[] anchorPoint = RectangleAnchor.coordinates(
                    area, position.getCategoryAnchor()
                );
                TextBlock block = tick.getLabel();
                block.draw(
                    g2,
                    (float) anchorPoint[0], (float) anchorPoint[1], position.getLabelAnchor(),
                    (float) anchorPoint[0], (float) anchorPoint[1], position.getAngle()
                );
                Shape bounds = block.calculateBounds(
                    g2, (float) anchorPoint[0], (float) anchorPoint[1], position.getLabelAnchor(),
                    (float) anchorPoint[0], (float) anchorPoint[1], position.getAngle()
                );
                if (plotState != null) {
                    EntityCollection entities = plotState.getOwner().getEntityCollection();
View Full Code Here

            }
            int categoryIndex = 0;
            Iterator iterator = categories.iterator();
            while (iterator.hasNext()) {
                Comparable category = (Comparable) iterator.next();
                TextBlock label = createLabel(category, l * r, edge, g2);
                if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) {
                    max = Math.max(max, calculateTextBlockHeight(label, position, g2));
                }
                else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT) {
                    max = Math.max(max, calculateTextBlockWidth(label, position, g2));
View Full Code Here

     *
     * @return a label.
     */
    protected TextBlock createLabel(Comparable category, float width,
                                    RectangleEdge edge, Graphics2D g2) {
        TextBlock label = TextUtilities.createTextBlock(
            category.toString(), getTickLabelFont(), getTickLabelPaint(),
            width, this.maxCategoryLabelLines, new G2TextMeasurer(g2)
        )
        return label;
    }
View Full Code Here

        for (int i = 0; i < leftKeys.getItemCount(); i++) {  
            String label = this.labelGenerator.generateSectionLabel(
                this.dataset, leftKeys.getKey(i)
            );
            if (label != null) {
                TextBlock block = TextUtilities.createTextBlock(
                    label,
                    this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)
                );
                TextBox labelBox = new TextBox(block);
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
View Full Code Here

            String label = this.labelGenerator.generateSectionLabel(
                this.dataset, keys.getKey(i)
            );

            if (label != null) {
                TextBlock block = TextUtilities.createTextBlock(
                    label, this.labelFont, this.labelPaint,
                    maxLabelWidth, new G2TextMeasurer(g2)
                );
                TextBox labelBox = new TextBox(block);
                labelBox.setBackgroundPaint(this.labelBackgroundPaint);
View Full Code Here

     */
    public float getPreferredWidth(Graphics2D g2, float height) {
        float result = 0.0f;
        if (this.text != null && !this.text.equals("")) {
            g2.setFont(this.font);
            TextBlock title = TextUtilities.createTextBlock(
                this.text, this.font, this.paint, height, new G2TextMeasurer(g2)
            );
            Size2D d = title.calculateDimensions(g2);
            result = (float) getSpacer().getAdjustedWidth(d.getHeight());
                                                     // use height here because the title
                                                     // is displayed rotated
        }
        if (LOGGER.isDebugEnabled()) {
View Full Code Here

TOP

Related Classes of org.jfree.text.TextBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.