--- old/src/org/netbeans/jemmy/operators/ComponentOperator.java 2018-08-17 10:52:18.950192598 -0700 +++ new/src/org/netbeans/jemmy/operators/ComponentOperator.java 2018-08-17 10:52:18.882191656 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,6 @@ import java.util.Hashtable; import java.util.Locale; -import static java.lang.Math.abs; - import org.netbeans.jemmy.CharBindingMap; import org.netbeans.jemmy.ComponentChooser; import org.netbeans.jemmy.ComponentSearcher; @@ -1222,6 +1220,48 @@ } /** + * Wait till the component reaches exact location on screen. + * + * @param exactLocation exact expected screen location. + */ + public void waitComponentLocationOnScreen(Point exactlocation) { + waitComponentLocationOnScreen(exactlocation, exactlocation); + } + + /** + * Wait till the component location on screen reaches between minLocation + * and maxLocation + * + * @param minLocation minimum expected location on screen. + * @param maxLocation maximum expected location on screen. + */ + public void waitComponentLocationOnScreen( + final Point minLocation, final Point maxLocation) { + waitState(new ComponentChooser() { + @Override + public boolean checkComponent(Component comp) { + Point location = comp.getLocationOnScreen(); + return location.x >= minLocation.x + && location.x <= maxLocation.x + && location.y >= minLocation.y + && location.y <= maxLocation.y; + } + + @Override + public String getDescription() { + return "Component location on screen reaches between :" + + minLocation + "and " + maxLocation; + } + + @Override + public String toString() { + return "ComponentOperator.waitComponentLocationOnScreen" + + ".Waitable{description = " + getDescription() + '}'; + } + }); + } + + /** * Returns information about component. */ @Override