grow Rectangle2D - Java 2D Graphics

Java examples for 2D Graphics:Rectangle

Description

grow Rectangle2D

Demo Code

/**//ww w  .j a  v a 2 s .c o m
 * Copyright (c) 2010-2014, Jean-Daniel Fekete, Pierre Dragicevic, and INRIA.
 * All rights reserved.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
//package com.java2s;

import java.awt.geom.Rectangle2D;

public class Main {
    public static void grow(Rectangle2D r, float amountx, float amounty) {
        r.setRect(r.getX() - amountx, r.getY() - amounty, r.getWidth()
                + amountx * 2, r.getHeight() + amounty * 2);
    }
}

Related Tutorials