static void checkSecurity() {
   if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
     StackTraceElement stack[] = (new Throwable()).getStackTrace();
     log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
   }
 }