Package diva.canvas.toolbox

Examples of diva.canvas.toolbox.BasicRectangle


        width = Math.floor(stringBounds.getWidth()) + 20;
        height = Math.floor(stringBounds.getHeight()) + 10;

        if (_spacingValue == 0.0) {
            if (_roundingValue == 0.0) {
                return new BasicRectangle(0, 0, width, height, _getFill(),
                        _getLineWidth());
            } else {
                return new RoundedRectangle(0, 0, width, height, _getFill(),
                        _getLineWidth(), _roundingValue, _roundingValue);
            }
        } else {
            CompositeFigure result;
            if (_roundingValue == 0.0) {
                result = new CompositeFigure(new BasicRectangle(-_spacingValue,
                        -_spacingValue, width + 2 * _spacingValue, height + 2
                                * _spacingValue, null, _getLineWidth()));
                result.add(new BasicRectangle(0, 0, width, height, _getFill(),
                        _getLineWidth()));
            } else {
                result = new CompositeFigure(new RoundedRectangle(
                        -_spacingValue, -_spacingValue, width + 2
                                * _spacingValue, height + 2 * _spacingValue,
 
View Full Code Here


                    // Do nothing.
                }
            }
        }

        return new BasicRectangle(0, 0, width, height, Color.white, 1);
    }
View Full Code Here

            // NOTE: Padding of 20.
            width = stringBounds.getWidth() + 20;
            heigth = stringBounds.getHeight() + 10;
        }

        BasicRectangle result = new BasicRectangle(0, 0, width, heigth,
                Color.white, 1);

        // FIXME: Doesn't do the right thing.
        // result.setCentered(false);
        return result;
View Full Code Here

            BasicFigure f;

            if (isEllipse) {
                f = new BasicEllipse(0, 0, _size, _size);
            } else {
                f = new BasicRectangle(0, 0, _size, _size);
                f.setFillPaint(Color.blue);
            }

            String label = actor.getName();
            LabelWrapper w = new LabelWrapper(f, label);
View Full Code Here

    /** Draw some figures
     */
    public void drawFigures() {
        // Here's a square
        BasicRectangle rect = new BasicRectangle(40.0, 40.0, 80.0, 80.0);
        rect.setLineWidth(8);
        rect.setStrokePaint(Color.red);
        figureLayer.add(rect);
        rect.setInteractor(selectionInteractor);

        // Here's an ellipse
        BasicEllipse oval = new BasicEllipse(160.0, 10.0, 120.0, 80.0);
        oval.setLineWidth(2);
        oval.setFillPaint(Color.magenta);
View Full Code Here

        int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC,
                Font.BOLD | Font.ITALIC, Font.PLAIN, Font.BOLD, Font.ITALIC,
                Font.BOLD | Font.ITALIC, Font.PLAIN };

        // Draw a rectangle to position them
        BasicRectangle square = new BasicRectangle(160, 80, 120, 120);
        square.setStrokePaint(Color.gray);
        layer.add(square);

        // Create the labels
        for (int i = 0; i < anchors.length; i++) {
            LabelFigure labelFigure = new LabelFigure(labels[i], fonts[i],
                    styles[i], 20);

            // Set the anchor
            labelFigure.setAnchor(anchors[i]);

            // Move the anchor to the right location
            Point2D pt = CanvasUtilities.getLocation(square.getBounds(),
                    CanvasUtilities.reverseDirection(anchors[i]));
            labelFigure.translateTo(pt);

            // Add to the layer
            layer.add(labelFigure);
View Full Code Here

        Figure a = new BasicEllipse(420, 100, 100, 50);
        LabelWrapper wrapperA = new LabelWrapper(a, "Foo!\nBar!\nBaz!");
        layer.add(wrapperA);
        wrapperA.setInteractor(defaultInteractor);

        Figure b = new BasicRectangle(460, 200, 50, 40, Color.green);
        LabelWrapper wrapperB = new LabelWrapper(b, "Bar!");
        wrapperB.setAnchor(SwingConstants.SOUTH_WEST);
        wrapperB.getLabel().setAnchor(SwingConstants.NORTH_WEST);
        layer.add(wrapperB);
        wrapperB.setInteractor(defaultInteractor);
View Full Code Here

TOP

Related Classes of diva.canvas.toolbox.BasicRectangle

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.