Package com.mckoi.jfccontrols
Class SwingBlockUtil
- java.lang.Object
-
- com.mckoi.jfccontrols.SwingBlockUtil
-
public class SwingBlockUtil extends java.lang.Object
Helper class for providing blocking behaviour on the AWT/Swing event dispatcher thread without freezing up the user interface. While the call to 'block' will block with respect to the callee, events will still be serviced from within the 'block' method.I consider this a mild hack. This class may be incompatible with future versions of Java if the AWT event mechanism is altered. It may also not work happily with non-Sun based implementations of Java.
- Author:
- Tobias Downer
-
-
Constructor Summary
Constructors Constructor Description SwingBlockUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
block()
Utility that blocks the Swing EventDispatchThread, and then emulates the inner loop of the dispatcher thread itself.void
unblock()
Unblocks any call to the 'block' method.
-
-
-
Method Detail
-
block
public void block()
Utility that blocks the Swing EventDispatchThread, and then emulates the inner loop of the dispatcher thread itself. This allows for repaint and button events to be processed. When the block has finished, this method will return and return control to the originating event dispatcher.
-
unblock
public void unblock()
Unblocks any call to the 'block' method. This method can safely be executed from any thread (even the Swing dispatcher thread).
-
-