Java tutorial
import java.awt.Point; import javax.swing.JButton; import javax.swing.SwingUtilities; public class Main { public static void main(String[] argv) { JButton component = new JButton(); Point pt = new Point(component.getLocation()); SwingUtilities.convertPointFromScreen(pt, component); } }