[xena] deprecated constructor RelativePoint(screenCooridnates), fixed computing of preferred container [r=anna.kozlova]

This commit is contained in:
Kirill Kalishev
2011-05-12 13:17:56 +04:00
parent a58f6b4e0d
commit 353b862fb7
@@ -40,9 +40,21 @@ public class RelativePoint {
public RelativePoint(Point screenPoint) {
Point p = new Point(screenPoint.x, screenPoint.y);
Frame c = JOptionPane.getRootFrame();
SwingUtilities.convertPointFromScreen(p, c);
init(c, p);
Window[] windows = Frame.getWindows();
Window targetWindow = null;
for (Window each : windows) {
if (each.isActive()) {
targetWindow = each;
break;
}
}
if (targetWindow == null) {
targetWindow = JOptionPane.getRootFrame();
}
SwingUtilities.convertPointFromScreen(p, targetWindow);
init(targetWindow, p);
}
private void init(Component aComponent, Point aPointOnComponent) {