Here you can find the source of normalizeRect(Rectangle rect)
public static void normalizeRect(Rectangle rect)
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import java.awt.Rectangle; public class Main { public static void normalizeRect(Rectangle rect) { if (rect.width < 0) { rect.width = -rect.width;//from w w w .j ava2s . co m rect.x -= rect.width; } if (rect.height < 0) { rect.height = -rect.height; rect.y -= rect.height; } } }