Here is an example that shows how to check which monitor/display a GUI object is being shown on:
def get_monitor_id_swing(swing_component):
return swing_component.getGraphicsConfiguration().getDevice().getIDstring()
def main():
#...
obj = waitForObject({"caption": "7", "type": "javax.swing.JButton"})
id = get_monitor_id_swing(obj)
test.log("Widget is on monitor/display #%s" % id)