Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.gui.event
Class EventDispatcher

java.lang.Object
  extended by org.monte.media.concurrent.EventLoop
      extended by ch.randelshofer.gui.event.EventDispatcher

public class EventDispatcher
extends org.monte.media.concurrent.EventLoop

Processes java.awt.ActiveEvent's on a background thread.

Example
This writes Hello World on the background thread of the EventDispatcher:


 ActiveEvent event = new ActiveEvent() {
     public void dispatch() {
          System.out.println("Hello World");
     }
 };
 
 EventDispatcher dispatcher = new EventDispatcher();
 dispatcher.dispatch(event);
 

Version:
1.1 2001-08-24 Reworked for JDK 1.3.
1.0 1998-10-07 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class org.monte.media.concurrent.EventLoop
eventProcessor
 
Constructor Summary
EventDispatcher()
          Creates a new event dispatcher which dispatches events at Thread.NORM_PRIORITY.
EventDispatcher(int threadPriority)
          Creates a new EventDispatcher which processes events at the desired thread priority.
 
Method Summary
 void dispatch(java.awt.ActiveEvent event)
          Collects an event for later processing.
protected  void processEvent(java.lang.Object event)
          Calls the #dispatch method of the ActiveEvent.
 
Methods inherited from class org.monte.media.concurrent.EventLoop
clear, collectEvent, isCoalesce, join, processEvents, setCoalesce, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventDispatcher

public EventDispatcher()
Creates a new event dispatcher which dispatches events at Thread.NORM_PRIORITY.


EventDispatcher

public EventDispatcher(int threadPriority)
Creates a new EventDispatcher which processes events at the desired thread priority.

Parameters:
threadPriority - The Thread priority of the event processor.
Method Detail

processEvent

protected void processEvent(java.lang.Object event)
Calls the #dispatch method of the ActiveEvent.

Specified by:
processEvent in class org.monte.media.concurrent.EventLoop
Parameters:
event - An instance of java.awt.ActiveEvent.

dispatch

public void dispatch(java.awt.ActiveEvent event)
Collects an event for later processing.


Copyright 2012-02-25 Werner Randelshofer