myTargetComponent = (JComponent) target.getComponent();
myTargetWindow = SwingUtilities.getWindowAncestor(myTargetComponent);
final JLayeredPane layered = getLayeredPane(myTargetWindow);
final Rectangle layeredBounds = new RelativeRectangle(layered).getScreenRectangle();
final boolean[] outside = getOutsideAxisCodes(layeredBounds, frameBounds);
if (outside != null) {
boolean x = outside[0];
boolean y = outside[1];