Package java.awt.geom

Examples of java.awt.geom.Ellipse2D


     * The shape is bounded by the rectangle (0,0,100,100).
     */
    public static Shape createCloudShape() {
        if (jdk12beta4()) {
            Area area = new Area();
            Ellipse2D c = new Ellipse2D.Double();
            c.setFrame(0, 25, 50, 50);
            area.add(new Area(c));
            c.setFrame(25, 0, 40, 40);
            area.add(new Area(c));
            c.setFrame(25, 25, 60, 60);
            area.add(new Area(c));
            c.setFrame(60, 30, 40, 40);
            area.add(new Area(c));
            c.setFrame(60, 10, 30, 30);
            area.add(new Area(c));
            return area;
        } else {
            GeneralPath cloud = new GeneralPath();
            cloud.moveTo(25.53f, 25.00f);
View Full Code Here


            _outsideEllipse.setLineWidth(1);
            break;

        case INITIAL_STATE:

            Ellipse2D bounds = (Ellipse2D) _outsideEllipse.shape;
            Shape s = new Ellipse2D.Double(bounds.getX() + _spacing, bounds
                    .getY()
                    + _spacing, bounds.getWidth() - (2 * _spacing), bounds
                    .getHeight()
                    - (2 * _spacing));

            _insideEllipse = new PaintedShape(s);
            _outsideEllipse.setLineWidth(1);
View Full Code Here

    /**
     * Returns a Shape representing a thumb.
     */
    private Shape createThumbShape(int width, int height) {
        // Use circular shape.
        Ellipse2D shape = new Ellipse2D.Double(0, 0, width, height);
        return shape;
    }
View Full Code Here

    private void paintButton(Graphics2D graphics, boolean enabled, boolean selected) {
        Paint buttonPaint;
        Color buttonBorderColorLocal = null;
        Color buttonSelectionColorLocal = null;

        Ellipse2D buttonBackgroundCircle = new Ellipse2D.Double(1, 1,
            BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);

        if (enabled) {
            buttonPaint = new RadialGradientPaint((float)buttonBackgroundCircle.getCenterX(),
                (float)buttonBackgroundCircle.getCenterY(),
                (float)buttonBackgroundCircle.getWidth() * 2 / 3,
                new float[] {0f, 1f}, new Color[] {TerraTheme.darken(buttonColor), buttonColor});

            buttonBorderColorLocal = this.buttonBorderColor;
            buttonSelectionColorLocal = this.buttonSelectionColor;
        }
        else {
            buttonPaint = disabledButtonColor;
            buttonBorderColorLocal = disabledButtonBorderColor;
            buttonSelectionColorLocal = disabledButtonSelectionColor;
        }

        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);

        // Paint the border
        graphics.setColor(buttonBorderColorLocal);
        graphics.fillOval(0, 0, BUTTON_DIAMETER - 1, BUTTON_DIAMETER - 1);

        // Paint the background
        graphics.setPaint(buttonPaint);
        graphics.fill(buttonBackgroundCircle);

        // Paint the selection
        if (selected) {
            Ellipse2D buttonSelectionCircle = new Ellipse2D.Double((BUTTON_DIAMETER
                - (BUTTON_SELECTION_DIAMETER - 1)) / 2,
                (BUTTON_DIAMETER - (BUTTON_SELECTION_DIAMETER - 1)) / 2,
                BUTTON_SELECTION_DIAMETER - 1, BUTTON_SELECTION_DIAMETER - 1);
            graphics.setColor(buttonSelectionColorLocal);
            graphics.fill(buttonSelectionCircle);
View Full Code Here

     * @param       width the width of the oval to be filled.
     * @param       height the height of the oval to be filled.
     * @see         java.awt.Graphics#drawOval
     */
    public void fillOval(int x, int y, int width, int height){
        Ellipse2D oval = new Ellipse2D.Float(x, y, width, height);
        fill(oval);
    }
View Full Code Here

   
  @Override
  public void propagatePosition() {
    final EdgeLocationModel location = (EdgeLocationModel) getModelElement().getLocation();
    // search the edge at our position
    final Ellipse2D rect = new Ellipse2D.Double(getPosition().getX(), getPosition().getY(), 2*SOME_WEIRD_MAGIC_EPSILON, 2*SOME_WEIRD_MAGIC_EPSILON);
    final List<WayView> ways = GraphUtils.getWaysIn(graphController, rect);
    EdgeModel foundForwardEdge = null;
    EdgeModel foundBackwardEdge = null;
    EdgeModel chosenEdge = null;
   
View Full Code Here

        assertNotNull(box);
        checkBounds(17, 1, 7, box);
        box = view.modelToView(4, new Rectangle(0, 0, 1, 1), Position.Bias.Forward);
        assertNotNull(box);
        checkBounds(1, 0, 1, box);
        Ellipse2D ellipse = new Ellipse2D.Float(25, 3, 30, 40);
        box = view.modelToView(4, ellipse, Position.Bias.Forward);
        checkBounds(55, 3, 40, box);
        box = view.modelToView(4, ellipse, Position.Bias.Backward);
        assertNotNull(box);
        checkBounds(55, 3, 40, box);
View Full Code Here

        assertNotNull(box);
        checkBounds(17, 1, 7, box);
        box = view.modelToView(4, new Rectangle(0, 0, 1, 1), Position.Bias.Forward);
        assertNotNull(box);
        checkBounds(1, 0, 1, box);
        Ellipse2D ellipse = new Ellipse2D.Float(25, 3, 30, 40);
        box = view.modelToView(4, ellipse, Position.Bias.Forward);
        checkBounds(55, 3, 40, box);
        box = view.modelToView(4, ellipse, Position.Bias.Backward);
        assertNotNull(box);
        checkBounds(55, 3, 40, box);
View Full Code Here

        Graphics g = createTestGraphics();
        shape = new Rectangle(4, 3, 2, 3);
        checkPaintIcon(g, shape, 10, 15);
        shape = new Rectangle(4, 3, 30, 40);
        checkPaintIcon(g, shape, 10, 15);
        shape = new Ellipse2D() {
            @Override
            public double getX() {
                return 12;
            }
View Full Code Here

        checkViewToModel(shape, 12, 5);
        checkViewToModel(shape, 15, 5);
        checkViewToModel(shape, 16, 5);
        checkViewToModel(shape, 30, 5);
        checkViewToModel(shape, 46, 5);
        final Ellipse2D floatEllipse = new Ellipse2D.Float(25, 3, 3, 4);
        checkViewToModelWithEllipse(floatEllipse);
        Ellipse2D intEllipse = new Ellipse2D() {
            @Override
            public double getX() {
                return 25;
            }
View Full Code Here

TOP

Related Classes of java.awt.geom.Ellipse2D

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.