< prev index next >
src/java.desktop/share/classes/java/awt/Robot.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1999, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 31,47 ****
import java.awt.image.DataBufferInt;
import java.awt.image.DirectColorModel;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.awt.peer.RobotPeer;
- import java.lang.reflect.InvocationTargetException;
- import java.security.AccessController;
import sun.awt.AWTPermissions;
import sun.awt.ComponentFactory;
import sun.awt.SunToolkit;
- import sun.awt.OSInfo;
import sun.awt.image.SunWritableRaster;
/**
* This class is used to generate native system input events
* for the purposes of test automation, self-running demos, and
--- 31,44 ----
*** 556,588 ****
* Waits until all events currently on the event queue have been processed.
* @throws IllegalThreadStateException if called on the AWT event dispatching thread
*/
public synchronized void waitForIdle() {
checkNotDispatchThread();
-
- try {
SunToolkit.flushPendingEvents();
- // 7185258: realSync() call blocks all DnD tests on OS X
- if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) {
- // post a dummy event to the queue so we know when
- // all the events before it have been processed
- EventQueue.invokeAndWait( new Runnable() {
- public void run() {
- // dummy implementation
- }
- } );
- } else {
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
}
- } catch(InterruptedException ite) {
- System.err.println("Robot.waitForIdle, non-fatal exception caught:");
- ite.printStackTrace();
- } catch(InvocationTargetException ine) {
- System.err.println("Robot.waitForIdle, non-fatal exception caught:");
- ine.printStackTrace();
- }
- }
private void checkNotDispatchThread() {
if (EventQueue.isDispatchThread()) {
throw new IllegalThreadStateException("Cannot call method from the event dispatcher thread");
}
--- 553,565 ----
*** 591,600 ****
--- 568,578 ----
/**
* Returns a string representation of this Robot.
*
* @return the string representation.
*/
+ @Override
public synchronized String toString() {
String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
return getClass().getName() + "[ " + params + " ]";
}
}
< prev index next >