Java tutorial
//package com.java2s; import java.awt.*; public class Main { /** * Returns the screen location for a component and X and Y. */ private static Point getScreenLocation(Component aComp, int anX, int aY) { Point point = aComp != null && aComp.isShowing() ? aComp.getLocationOnScreen() : new Point(); point.x += anX; point.y += aY; return point; } }