Java examples for Swing:Screen
get Location In Window
//package com.java2s; import java.awt.Component; import java.awt.Point; import java.awt.Window; public class Main { public static Point getLocationInWindow(Component c, Window w) { Point cPoint = c.getLocationOnScreen(); Point wPoint = w.getLocationOnScreen(); return new Point(cPoint.x - wPoint.x, cPoint.y - wPoint.y); }/*w w w .ja va 2s . c o m*/ }