Package org.jfree.text

Examples of org.jfree.text.TextBlock


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

        double verticalLinkRadius = state.getLinkArea().getHeight() / 2.0;
        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);
                labelBox.setOutlinePaint(this.labelOutlinePaint);
View Full Code Here

        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

     *
     * @return A label.
     */
    protected TextBlock createLabel(Comparable category, float width,
                                    RectangleEdge edge, Graphics2D g2) {
        TextBlock label = super.createLabel(category, width, edge, g2);  
        String s = (String) this.sublabels.get(category);
        if (s != null) {
            if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM) {
                TextLine line = new TextLine(s, this.sublabelFont,
                        this.sublabelPaint);
                label.addLine(line);
            }
            else if (edge == RectangleEdge.LEFT
                    || edge == RectangleEdge.RIGHT) {
                TextLine line = label.getLastLine();
                if (line != null) {
                    line.addFragment(new TextFragment("  " + s,
                            this.sublabelFont, this.sublabelPaint));
                }
            }
View Full Code Here

        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);
    }
View Full Code Here

        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

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
       
        final TextBlock b1 = new TextBlock();
        b1.addLine(new TextLine("Test"));
        final TextBlock b2 = new TextBlock();
        b2.addLine(new TextLine("Test"));
        assertTrue(b1.equals(b2));
        assertTrue(b2.equals(b1));

    }
View Full Code Here

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

        final TextBlock b1 = new TextBlock();
        b1.addLine(new TextLine("Test"));
        TextBlock b2 = null;

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

                                      size.getHeight() - insets.top - insets.bottom);

        final double x = available.getX();
        final double y = available.getY();
        final float width = (float) available.getWidth();
        final TextBlock block = TextUtilities.createTextBlock(
            this.text, this.font, Color.black, width, new G2TextMeasurer(g2)
        );
        g2.setPaint(Color.black);
        block.draw(g2, (float) x, (float) y, TextBlockAnchor.TOP_LEFT, 0.0f, 0.0f, 0.0);

    }
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.