/** * Binds an event listener to a specific method on a specific object. * * @param <L> the event listener type * @param target the target object * @param methodName the name of the method to be called * @param eventSource the object which is generating events (JButton, JList, etc.) * @param listenerType the listener interface (ActionListener.class, SelectionListener.class, etc.) * @param eventTypes the event types (method names) from the listener interface (if none specified, all will be * supported) */ public static <L> void bindEventsToMethod(final Object target, final String methodName, final Object eventSource, final Class<L> listenerType, final String... eventTypes) { final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes))); addEventListener(eventSource, listenerType, listener); }
/** * Binds an event listener to a specific method on a specific object. * * @param <L> the event listener type * @param target the target object * @param methodName the name of the method to be called * @param eventSource the object which is generating events (JButton, JList, etc.) * @param listenerType the listener interface (ActionListener.class, SelectionListener.class, etc.) * @param eventTypes the event types (method names) from the listener interface (if none specified, all will be * supported) */ public static <L> void bindEventsToMethod(final Object target, final String methodName, final Object eventSource, final Class<L> listenerType, final String... eventTypes) { final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes))); addEventListener(eventSource, listenerType, listener); }
/** * Binds an event listener to a specific method on a specific object. * * @param <L> the event listener type * @param target the target object * @param methodName the name of the method to be called * @param eventSource the object which is generating events (JButton, JList, etc.) * @param listenerType the listener interface (ActionListener.class, SelectionListener.class, etc.) * @param eventTypes the event types (method names) from the listener interface (if none specified, all will be * supported) */ public static <L> void bindEventsToMethod(final Object target, final String methodName, final Object eventSource, final Class<L> listenerType, final String... eventTypes) { final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes))); addEventListener(eventSource, listenerType, listener); }
/** * Binds an event listener to a specific method on a specific object. * * @param <L> the event listener type * @param target the target object * @param methodName the name of the method to be called * @param eventSource the object which is generating events (JButton, JList, etc.) * @param listenerType the listener interface (ActionListener.class, SelectionListener.class, etc.) * @param eventTypes the event types (method names) from the listener interface (if none specified, all will be * supported) */ public static <L> void bindEventsToMethod(final Object target, final String methodName, final Object eventSource, final Class<L> listenerType, final String... eventTypes) { final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes))); addEventListener(eventSource, listenerType, listener); }