void flushBuffers() { if (isVisible() && !nativeBounds.isEmpty() && !isFullScreenMode) { try { LWCToolkit.invokeAndWait( new Runnable() { @Override public void run() { // Posting an empty to flush the EventQueue without blocking the main thread } }, target); } catch (InvocationTargetException e) { e.printStackTrace(); } } }