Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.lang3.event
Class EventUtils

    java.lang.Object
      org.apache.commons.lang3.event.EventUtils

    public class EventUtils

extends Object

Provides some useful event-based utility methods.

Since:
  3.0
Version:
  $Id: EventUtils.java 1091072 2011-04-11 13:42:03Z mbenson $

Constructor Summary
`EventUtils()`

Method Summary
`static
`<L> void`
` | `addEventListener(Object eventSource, Class<L> listenerType, L listener)` Adds an event listener to the specified source.
`static
`<L> void`
` | `bindEventsToMethod(Object target, String methodName, Object eventSource, Class<L> listenerType, String... eventTypes)` Binds an event listener to a specific method on a specific object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EventUtils

    public EventUtils()

Method Detail

### addEventListener

    public static <L> void addEventListener(Object eventSource,
                                            Class<L> listenerType,
                                            L listener)

  Adds an event listener to the specified source. This looks for an "add" method corresponding to the event type (addActionListener, for example).

  Type Parameters:
    `L` - the event listener type
  Parameters:
    `eventSource` - the event source
    `listenerType` - the event listener type
    `listener` - the listener
  Throws:
    `IllegalArgumentException` - if the object doesn't support the listener type

### bindEventsToMethod

    public static <L> void bindEventsToMethod(Object target,
                                              String methodName,
                                              Object eventSource,
                                              Class<L> listenerType,
                                              String... eventTypes)

  Binds an event listener to a specific method on a specific object.

  Type Parameters:
    `L` - the event listener type
  Parameters:
    `target` - the target object
    `methodName` - the name of the method to be called
    `eventSource` - the object which is generating events (JButton, JList, etc.)
    `listenerType` - the listener interface (ActionListener.class, SelectionListener.class, etc.)
    `eventTypes` - the event types (method names) from the listener interface (if none specified, all will be supported)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.