Package com.illumon.iris.gui.util
Class IrisSwingUtilities
java.lang.Object
com.illumon.iris.gui.util.IrisSwingUtilities
public class IrisSwingUtilities extends Object
Utility class for swing related methods.
-
Constructor Summary
Constructors Constructor Description IrisSwingUtilities()
-
Method Summary
Modifier and Type Method Description static void
adjustFocus(JComponent c)
Ensure that the passed-in component is the focused item.static void
invokeAndWaitOnEventThread(Runnable doRun)
Run immediately if this is the Event Thread, else invokeLater() or invokeAndWait() if synchronous is true.static void
invokeOffEventThread(Runnable doRun)
Run immediately if this is not the Event Thread, else run on a dedicated single-purpose threadstatic void
invokeOffEventThread(Runnable doRun, ExecutorService pool)
Run immediately if this is not the Event Thread, else run on the supplied thread poolstatic void
invokeOnEventThread(Runnable doRun)
Run immediately if this is the Event Thread, else invokeLater().static boolean
isEventDispatchThreadOrTestMode()
static void
setTestMode()
static boolean
shouldIgnore(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, InterruptedExceptionRun immediately if this is the Event Thread, else invokeLater() or invokeAndWait() if synchronous is true.- Parameters:
doRun
- the stuff to do- Throws:
InvocationTargetException
InterruptedException
-
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
-