Here you can find the source of getAbsoluteRectangle(Rectangle rect)
Parameter | Description |
---|---|
rect | a parameter |
public static Rectangle getAbsoluteRectangle(Rectangle rect)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { /**//from w ww . j av a 2 s . co m * if rectangle has negative width or height, convert to equivalent rectangle * with posititve width or height, else don't do anything * @param rect * @return */ public static Rectangle getAbsoluteRectangle(Rectangle rect) { if (rect == null) return null; Rectangle r = new Rectangle(rect); // take care of negative width height if (r.width < 0) { r.width = -r.width; r.x = r.x - r.width; } if (r.height < 0) { r.height = -r.height; r.y = r.y - r.height; } // take care of width height that are 0 if (r.width == 0) r.width = 1; if (r.height == 0) r.height = 1; return r; } }