List of usage examples for javax.swing.event EventListenerList getListenerList
public Object[] getListenerList()
From source file:Main.java
public static EventListener[] getListeners(EventListenerList listenerList, Class t) { Object[] lList = listenerList.getListenerList(); int n = getListenerCount(lList, t); EventListener[] result = (EventListener[]) java.lang.reflect.Array.newInstance(t, n); int j = 0;//w w w . j a v a 2 s. c o m for (int i = lList.length - 2; i >= 0; i -= 2) { if (lList[i] == t) { result[j++] = (EventListener) lList[i + 1]; } } return result; }
From source file:Main.java
/** * Checks if the listener is always registered to the EventListenerList to avoid duplicated registration of the same listener * * @param list the EventListenerList to register the listener. * @param t the type of the EventListener. * @param l the listener./*from w w w . j a v a2 s.co m*/ * @return true if already registered. Otherwise false. */ public static boolean isListenerRegistered(EventListenerList list, Class t, EventListener l) { Object[] objects = list.getListenerList(); return isListenerRegistered(objects, t, l); }