Class UIThreadsUtil


  • public final class UIThreadsUtil
    extends java.lang.Object
    Utils for check UI threads and run specific code in UI threads only.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void executeInSwingThread​(java.lang.Runnable code)
      Execute code in swing thread only.
      static void mustBeSwingThread()
      Check if current thread is swing thread, and report error in log if it's not true.
      static void mustNotBeSwingThread()
      Check if current thread is NOT swing thread, and report error in log if it's not true.
      static <T> T returnResultFromSwingThread​(java.util.function.Supplier<T> s)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • executeInSwingThread

        public static void executeInSwingThread​(java.lang.Runnable code)
        Execute code in swing thread only.
      • returnResultFromSwingThread

        public static <T> T returnResultFromSwingThread​(java.util.function.Supplier<T> s)
      • mustBeSwingThread

        public static void mustBeSwingThread()
        Check if current thread is swing thread, and report error in log if it's not true.
      • mustNotBeSwingThread

        public static void mustNotBeSwingThread()
        Check if current thread is NOT swing thread, and report error in log if it's not true.