Here you can find the source of contains(Rectangle c, Rectangle a)
public static boolean contains(Rectangle c, Rectangle a)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static boolean contains(Rectangle c, Rectangle a) { return c.x <= a.x + a.width && c.x + c.width > a.x && c.y <= a.y + a.height && c.y + c.height > a.y; }//from ww w .j av a 2 s . c o m }