simulator.start();
Rectangle b = simulator.getBounds();
ScreenRegion s = new DesktopScreenRegion(b.x,b.y,b.width,b.height);
Target target;
List<ScreenRegion> rs;
// find all unchecked checkboxes ordered from bottom to top
target = new ImageTarget(Images.UncheckedCheckbox);
target.setLimit(15);
target.setOrdering(Target.Ordering.BOTTOM_UP);
rs = s.findAll(target);
canvas.addLabel(Relative.to(s).topLeft().getScreenLocation(), "Unchecked checkboxes found in bottom-up ordering");
for (int i=0; i < rs.size(); ++i){
ScreenRegion r = rs.get(i);
canvas.addBox(r);
canvas.addLabel(Relative.to(r).topLeft().left(20).getScreenLocation(), ""+(i+1));
}
canvas.display(5);
// find all styled rectangles (e.g., buttons) ordered from left to right
target = new StyledRectangleTarget(Images.ButtonOptions);
target.setOrdering(Target.Ordering.LEFT_RIGHT);
rs = s.findAll(target);
canvas.clear().addLabel(Relative.to(s).topLeft().getScreenLocation(), "Rectangles found in left-right ordering");
for (int i=0; i < rs.size(); ++i){