Package com.illumon.iris.gui.util
Class IrisSwingUtilities
java.lang.Object
com.illumon.iris.gui.util.IrisSwingUtilities
Utility class for swing related methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidEnsure that the passed-in component is the focused item.static voidRun immediately if this is the Event Thread, else invokeLater() or invokeAndWait() if synchronous is true.static voidinvokeOffEventThread(Runnable doRun) Run immediately if this is not the Event Thread, else run on a dedicated single-purpose threadstatic voidinvokeOffEventThread(Runnable doRun, ExecutorService pool) Run immediately if this is not the Event Thread, else run on the supplied thread poolstatic voidinvokeOnEventThread(Runnable doRun) Run immediately if this is the Event Thread, else invokeLater().static booleanstatic voidstatic booleanshouldIgnore(MouseEvent event, JComponent c) Check if an event should be ignored by a handler.
-
Constructor Details
-
IrisSwingUtilities
public IrisSwingUtilities()
-
-
Method Details
-
setTestMode
-
isEventDispatchThreadOrTestMode
public static boolean isEventDispatchThreadOrTestMode() -
invokeOnEventThread
Run immediately if this is the Event Thread, else invokeLater().- Parameters:
doRun- the stuff to do
-
invokeAndWaitOnEventThread
public static void invokeAndWaitOnEventThread(Runnable doRun) throws InvocationTargetException, InterruptedException Run immediately if this is the Event Thread, else invokeLater() or invokeAndWait() if synchronous is true.- Parameters:
doRun- the stuff to do- Throws:
InvocationTargetExceptionInterruptedException
-
invokeOffEventThread
Run immediately if this is not the Event Thread, else run on a dedicated single-purpose thread- Parameters:
doRun- the stuff to do
-
invokeOffEventThread
Run immediately if this is not the Event Thread, else run on the supplied thread pool- Parameters:
doRun- the stuff to dopool- a supplied thread pool where the stuff may be run
-
adjustFocus
Ensure that the passed-in component is the focused item.- Parameters:
c- the component to focus
-
shouldIgnore
Check if an event should be ignored by a handler. That is, if the component is enabled, or the event has already been consumed.- Parameters:
event- the eventc- the component- Returns:
- true if the event should be ignored, false otherwise
-