use of java.awt.AWTError in project jdk8u_jdk by JetBrains.
the class CThreading method executeOnAppKit.
public static <V> V executeOnAppKit(Callable<V> command) throws Throwable {
if (!isAppKit()) {
Dispatch dispatch = Dispatch.getInstance();
if (dispatch == null) {
throw new AWTError("Could not get Dispatch object");
}
FutureTask<V> future = new FutureTask<>(command);
dispatch.getNonBlockingMainQueueExecutor().execute(future);
try {
return future.get();
} catch (InterruptedException e) {
throw new AWTError(e.getMessage());
} catch (ExecutionException e) {
throw e.getCause();
}
} else
return command.call();
}
use of java.awt.AWTError in project jdk8u_jdk by JetBrains.
the class X11GraphicsEnvironment method getDefaultScreenDevice.
/**
* Returns the default screen graphics device.
*/
public GraphicsDevice getDefaultScreenDevice() {
GraphicsDevice[] screens = getScreenDevices();
if (screens.length == 0) {
throw new AWTError("no screen devices");
}
int index = getDefaultScreenNum();
return screens[0 < index && index < screens.length ? index : 0];
}
Aggregations