Java tutorial
//package com.java2s; import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; public class Main { public static void getComponentRect(Point locationOnScreen, Component component, Rectangle resultStorage) { Dimension size = component.getSize(); resultStorage.setRect(locationOnScreen.x, locationOnScreen.y, size.width, size.height); } }