Here you can find the source of getActiveRectangle(JComponent c)
public static Rectangle getActiveRectangle(JComponent c)
//package com.java2s; //License from project: Apache License import javax.swing.*; import java.awt.*; public class Main { public static Rectangle getActiveRectangle(JComponent c) { Dimension d = c.getSize(); Insets ins = c.getInsets(); int left = ins.left; int width = d.width - ins.right - ins.left; int top = ins.top; int height = d.height - ins.bottom - ins.top; Rectangle ret = new Rectangle(left, top, width, height); return ret; }/*from ww w .ja v a 2 s . c o m*/ }