Package org.jfree.text

Examples of org.jfree.text.TextBox


                    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);
                labelBox.setOutlinePaint(this.labelOutlinePaint);
                labelBox.setOutlineStroke(this.labelOutlineStroke);
                if (this.shadowGenerator == null) {
                    labelBox.setShadowPaint(this.labelShadowPaint);
                }
                else {
                    labelBox.setShadowPaint(null);
                }
                labelBox.setInteriorGap(this.labelPadding);
                double theta = Math.toRadians(
                        leftKeys.getValue(i).doubleValue());
                double baseY = state.getPieCenterY() - Math.sin(theta)
                               * verticalLinkRadius;
                double hh = labelBox.getHeight(g2);

                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
                        leftKeys.getKey(i), theta, baseY, labelBox, hh,
                        lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 1.0
                        - getLabelLinkDepth()
View Full Code Here


            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);
                labelBox.setOutlineStroke(this.labelOutlineStroke);
                if (this.shadowGenerator == null) {
                    labelBox.setShadowPaint(this.labelShadowPaint);
                }
                else {
                    labelBox.setShadowPaint(null);
                }
                labelBox.setInteriorGap(this.labelPadding);
                double theta = Math.toRadians(keys.getValue(i).doubleValue());
                double baseY = state.getPieCenterY()
                              - Math.sin(theta) * verticalLinkRadius;
                double hh = labelBox.getHeight(g2);
                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
                        keys.getKey(i), theta, baseY, labelBox, hh,
                        lGap / 2.0 + lGap / 2.0 * Math.cos(theta),
                        1.0 - getLabelLinkDepth()
                        + getExplodePercent(keys.getKey(i))));
View Full Code Here

                c.setCurve(targetX, targetY, anchorX, anchorY, elbowX, elbowY,
                        linkX, linkY);
                g2.draw(c);
            }
        }
        TextBox tb = record.getLabel();
        tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT);

    }
View Full Code Here

                        linkX, linkY);
                g2.draw(c);
            }
        }

        TextBox tb = record.getLabel();
        tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT);

    }
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        final TextBox b1 = new TextBox("Hello");
        final TextBox b2 = new TextBox("Hello");
        assertTrue(b1.equals(b2));
        assertTrue(b2.equals(b1));
       
        // outlinePaint
        b1.setOutlinePaint(Color.blue);
        assertFalse(b1.equals(b2));
        b2.setOutlinePaint(Color.blue);
        assertTrue(b1.equals(b2));

        // outlineStroke
        b1.setOutlineStroke(new BasicStroke(1.1f));
        assertFalse(b1.equals(b2));
        b2.setOutlineStroke(new BasicStroke(1.1f));
        assertTrue(b1.equals(b2));

        // interiorGap
        b1.setInteriorGap(new RectangleInsets(10, 10, 10, 10));
        assertFalse(b1.equals(b2));
        b2.setInteriorGap(new RectangleInsets(10, 10, 10, 10));
        assertTrue(b1.equals(b2));
       
        // backgroundPaint
        b1.setBackgroundPaint(Color.blue);
        assertFalse(b1.equals(b2));
        b2.setBackgroundPaint(Color.blue);
        assertTrue(b1.equals(b2));

        // shadowPaint
        b1.setShadowPaint(Color.blue);
        assertFalse(b1.equals(b2));
        b2.setShadowPaint(Color.blue);
        assertTrue(b1.equals(b2));

        // shadowXOffset
        b1.setShadowXOffset(1.0);
        assertFalse(b1.equals(b2));
        b2.setShadowXOffset(1.0);
        assertTrue(b1.equals(b2));
       
        // shadowYOffset
        b1.setShadowYOffset(1.0);
        assertFalse(b1.equals(b2));
        b2.setShadowYOffset(1.0);
        assertTrue(b1.equals(b2));
       
        // textBlock
        final TextBlock tb1 = new TextBlock();
        tb1.addLine(new TextLine("Testing"));
        b1.setTextBlock(tb1);
        assertFalse(b1.equals(b2));
        final TextBlock tb2 = new TextBlock();
        tb2.addLine(new TextLine("Testing"));
        b2.setTextBlock(tb2);
        assertTrue(b1.equals(b2));
       
    }
View Full Code Here

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

        final TextBox b1 = new TextBox("Hello");
        TextBox b2 = null;

        try {
            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            final ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(b1);
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        final TextBox b1 = new TextBox("Hello");
        final TextBox b2 = new TextBox("Hello");
        assertTrue(b1.equals(b2));
        assertTrue(b2.equals(b1));
       
        // outlinePaint
        b1.setOutlinePaint(Color.blue);
        assertFalse(b1.equals(b2));
        b2.setOutlinePaint(Color.blue);
        assertTrue(b1.equals(b2));

        // outlineStroke
        b1.setOutlineStroke(new BasicStroke(1.1f));
        assertFalse(b1.equals(b2));
        b2.setOutlineStroke(new BasicStroke(1.1f));
        assertTrue(b1.equals(b2));

        // interiorGap
        b1.setInteriorGap(new RectangleInsets(10, 10, 10, 10));
        assertFalse(b1.equals(b2));
        b2.setInteriorGap(new RectangleInsets(10, 10, 10, 10));
        assertTrue(b1.equals(b2));
       
        // backgroundPaint
        b1.setBackgroundPaint(Color.blue);
        assertFalse(b1.equals(b2));
        b2.setBackgroundPaint(Color.blue);
        assertTrue(b1.equals(b2));

        // shadowPaint
        b1.setShadowPaint(Color.blue);
        assertFalse(b1.equals(b2));
        b2.setShadowPaint(Color.blue);
        assertTrue(b1.equals(b2));

        // shadowXOffset
        b1.setShadowXOffset(1.0);
        assertFalse(b1.equals(b2));
        b2.setShadowXOffset(1.0);
        assertTrue(b1.equals(b2));
       
        // shadowYOffset
        b1.setShadowYOffset(1.0);
        assertFalse(b1.equals(b2));
        b2.setShadowYOffset(1.0);
        assertTrue(b1.equals(b2));
       
        // textBlock
        final TextBlock tb1 = new TextBlock();
        tb1.addLine(new TextLine("Testing"));
        b1.setTextBlock(tb1);
        assertFalse(b1.equals(b2));
        final TextBlock tb2 = new TextBlock();
        tb2.addLine(new TextLine("Testing"));
        b2.setTextBlock(tb2);
        assertTrue(b1.equals(b2));
       
    }
View Full Code Here

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

        final TextBox b1 = new TextBox("Hello");
        TextBox b2 = null;

        try {
            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            final ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(b1);
View Full Code Here

                    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);
                labelBox.setOutlinePaint(this.labelOutlinePaint);
                labelBox.setOutlineStroke(this.labelOutlineStroke);
                labelBox.setShadowPaint(this.labelShadowPaint);
                labelBox.setInteriorGap(this.labelPadding);
                double theta = Math.toRadians(
                        leftKeys.getValue(i).doubleValue());
                double baseY = state.getPieCenterY() - Math.sin(theta)
                               * verticalLinkRadius;
                double hh = labelBox.getHeight(g2);

                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
                        leftKeys.getKey(i), theta, baseY, labelBox, hh,
                        lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 0.9
                        + getExplodePercent(leftKeys.getKey(i))));
View Full Code Here

            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);
                labelBox.setOutlineStroke(this.labelOutlineStroke);
                labelBox.setShadowPaint(this.labelShadowPaint);
                labelBox.setInteriorGap(this.labelPadding);
                double theta = Math.toRadians(keys.getValue(i).doubleValue());
                double baseY = state.getPieCenterY()
                              - Math.sin(theta) * verticalLinkRadius;
                double hh = labelBox.getHeight(g2);
                this.labelDistributor.addPieLabelRecord(new PieLabelRecord(
                        keys.getKey(i), theta, baseY, labelBox, hh,
                        lGap / 2.0 + lGap / 2.0 * Math.cos(theta),
                        0.9 + getExplodePercent(keys.getKey(i))));
            }
View Full Code Here

TOP

Related Classes of org.jfree.text.TextBox

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.