Here you can find the source of getSubArea(Shape retangulo, int divisorx, int divisory, int offsetx, int offsety)
public static Rectangle getSubArea(Shape retangulo, int divisorx, int divisory, int offsetx, int offsety)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { public static Rectangle getSubArea(Shape retangulo, int divisorx, int divisory, int offsetx, int offsety) { double w = retangulo.getBounds().getWidth() / divisorx; double h = retangulo.getBounds().getHeight() / divisory; double x = retangulo.getBounds().getX() + (w * offsetx); double y = retangulo.getBounds().getY() + (h * offsety); Rectangle subRetangulo = new Rectangle((int) x, (int) y, (int) w, (int) h); return subRetangulo; }/*w w w.j a v a 2 s . c o m*/ }