Class EDTUtil
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidcoalescingInvokeLater(Runnable runnable) Invokes the given runnable on the EDT.static voidcoalescingInvokeLater(Runnable runnable, int delay) static Optional<HierarchyListener>invokeAfterFirstDisplayed(Component component, Runnable task) Calls a runnable after it is first displayed on the screen.static voidinvokeAfterJoin(Runnable runnable, Thread thread) Invokes the runnable on the EDT after waiting for the given thread to finish.static voidinvokeLater(Runnable runnable, int delay) Invokes the given runnable on the EDT after the delay.static <T> voidinvokeWhenComplete(CompletableFuture<T> future, BiConsumer<? super T, ? super Throwable> c) static RunnableCreates a runnable that will run the given runnable throughcoalescingInvokeLater(Runnable).static RunnableCreates a runnable that will run the given runnable throughcoalescingInvokeLater(Runnable).
- 
Constructor Details- 
EDTUtilpublic EDTUtil()
 
- 
- 
Method Details- 
invokeLaterInvokes the given runnable on the EDT after the delay.- Parameters:
- runnable- runnable to invoke
- delay- (in millis)
 
- 
invokeAfterJoinInvokes the runnable on the EDT after waiting for the given thread to finish.
- 
invokeWhenCompletepublic static <T> void invokeWhenComplete(CompletableFuture<T> future, BiConsumer<? super T, ? super Throwable> c) 
- 
memoizeCreates a runnable that will run the given runnable through coalescingInvokeLater(Runnable).This is useful for wrapping up lamdas, which aren't very friendly for sending directly to coalescingInvokeLater because they're never equal to each other, so they don't coalesce. The way to use this is to create one of these memoized runnables using your lamda, and call .run() on it whenever you need to invoke your lamda in a coalesced way. 
- 
memoizeCreates a runnable that will run the given runnable through coalescingInvokeLater(Runnable).This is useful for wrapping up lamdas, which aren't very friendly for sending directly to coalescingInvokeLater because they're never equal to each other, so they don't coalesce. The way to use this is to create one of these memoized runnables using your lamda, and call .run() on it whenever you need to invoke your lamda in a coalesced way. 
- 
coalescingInvokeLaterInvokes the given runnable on the EDT. If multiple runnables are posted during the same event processing using this function, and those runnables are .equals() equivalent, then only one of them will be called. Careful not to use this with lamdas, like: EDTUtil.coalescingInvokeLater(this::updateSomething); because it won't work - each call creates a new lambda that is not equal to the last one, so they won't coalesce.
- 
coalescingInvokeLater
- 
invokeAfterFirstDisplayedpublic static Optional<HierarchyListener> invokeAfterFirstDisplayed(Component component, Runnable task) Calls a runnable after it is first displayed on the screen. Returns an optional hierarchy listener if one needed to be added to the component. This happens if the component is not currently displayable and is responsible for deferring the task until the component has been marked displayable. Once this occurs the hierarchy listener is removed from the component, but if it has never been marked displayable the caller should remove this listener when appropriate
 
-