Java Code Examples for java.awt.geom.RectangularShape#clone()

The following examples show how to use java.awt.geom.RectangularShape#clone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShapeTransform.java    From pentaho-reporting with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Resizes a rectangle. This works for real rectangles and produces funny results for RoundRects etc ..
 *
 * @param rectangularShape
 *          the rectangle
 * @param width
 *          the new width of the rectangle
 * @param height
 *          the new height of the rectangle.
 * @return the resized rectangle.
 */
public static Shape resizeRect( final RectangularShape rectangularShape, final double width, final double height ) {
  final RectangularShape retval = (RectangularShape) rectangularShape.clone();
  retval.setFrame( retval.getX(), retval.getY(), width, height );
  return retval;
}