882 pushPopLock.unlock(); |
882 pushPopLock.unlock(); |
883 } |
883 } |
884 } |
884 } |
885 |
885 |
886 /** |
886 /** |
|
887 * Creates a new {@code secondary loop} associated with this |
|
888 * event queue. Use the {@link SecondaryLoop#enter} and |
|
889 * {@link SecondaryLoop#exit} methods to start and stop the |
|
890 * event loop and dispatch the events from this queue. |
|
891 * |
|
892 * @return secondaryLoop A new secondary loop object, which can |
|
893 * be used to launch a new nested event |
|
894 * loop and dispatch events from this queue |
|
895 * |
|
896 * @see SecondaryLoop#enter |
|
897 * @see SecondaryLoop#exit |
|
898 * |
|
899 * @since 1.7 |
|
900 */ |
|
901 public SecondaryLoop createSecondaryLoop() { |
|
902 return createSecondaryLoop(null, null, 0); |
|
903 } |
|
904 |
|
905 SecondaryLoop createSecondaryLoop(Conditional cond, EventFilter filter, long interval) { |
|
906 pushPopLock.lock(); |
|
907 try { |
|
908 if (nextQueue != null) { |
|
909 // Forward the request to the top of EventQueue stack |
|
910 return nextQueue.createSecondaryLoop(cond, filter, interval); |
|
911 } |
|
912 if (dispatchThread == null) { |
|
913 initDispatchThread(); |
|
914 } |
|
915 return new WaitDispatchSupport(dispatchThread, cond, filter, interval); |
|
916 } finally { |
|
917 pushPopLock.unlock(); |
|
918 } |
|
919 } |
|
920 |
|
921 /** |
887 * Returns true if the calling thread is |
922 * Returns true if the calling thread is |
888 * {@link Toolkit#getSystemEventQueue the current AWT EventQueue}'s |
923 * {@link Toolkit#getSystemEventQueue the current AWT EventQueue}'s |
889 * dispatch thread. Use this method to ensure that a particular |
924 * dispatch thread. Use this method to ensure that a particular |
890 * task is being executed (or not being) there. |
925 * task is being executed (or not being) there. |
891 * <p> |
926 * <p> |