Module org.jcommon

Class EventPool


  • public class EventPool
    extends Object
    Event pool class enable to share events between many components. The event pool register listeners and dispatch event. Components which have to fire event to other use the event pool to propagate it.
    This class use AWTEvent as a global event. So All event that can be fired on the event pool must be an AWTEvent or a subclass.
    Since:
    1.0.0
    Version:
    "1.0.12" - b202004280800L
    Author:
    Julien Seinturier - COMEX S.A. - contact@jorigin.org - https://github.com/jorigin/jeometry
    • Field Detail

      • idListenerList

        protected EventListenerList idListenerList
        The list of listenners attached to the pool
    • Constructor Detail

      • EventPool

        public EventPool()
        Construct a new event pool. This method creates the listener list.
    • Method Detail

      • addListener

        public void addListener​(AWTEventListener listener)
        Add a listener to the event pool. The listener must implements the interface AWTEventListener because the interface EventListener is empty and does not determine a dispatch method.
        Parameters:
        listener - the listener to add.
      • removeListener

        public void removeListener​(AWTEventListener listener)
        Remove a listener from the event pool. The listener must implements interface AWTEventListener because the interface EventListener is empty and does not determine a dispatch method.
        Parameters:
        listener - the listener to remove.
      • dispatchEvent

        public void dispatchEvent​(AWTEvent event)
        Dispatch a new event to all registered listeners. The event must be a subclass of AWTEvent because the listener are AWTEventListener.
        Parameters:
        event - the event to dispatch.