+ /** Waiting queue until at least one listener is here to get the events. */
+ private final Queue<ActionEvent> waitingQueue;
+
+ /**
+ * Create a new {@link ListenerPanel}.
+ */
+ public ListenerPanel() {
+ waitingQueue = new LinkedList<ActionEvent>();
+ }
+
+ /**
+ * Check that this {@link ListenerPanel} currently has
+ * {@link ActionListener}s that listen on it.
+ *
+ * @return TRUE if it has
+ */
+ public synchronized boolean hasListeners() {
+ return listenerList.getListenerList().length > 1;
+ }
+
+ /**
+ * Check how many events are currently waiting for an
+ * {@link ActionListener}.
+ *
+ * @return the number of waiting events (can be 0)
+ */
+ public synchronized int getWaitingEventCount() {
+ return waitingQueue.size();
+ }
+