< prev index next >

src/java.desktop/share/classes/javax/swing/JComboBox.java

Print this page




1218         // Guaranteed to return a non-null array
1219         Object[] listeners = listenerList.getListenerList();
1220         // Process the listeners last to first, notifying
1221         // those that are interested in this event
1222         for ( int i = listeners.length-2; i>=0; i-=2 ) {
1223             if ( listeners[i]==ItemListener.class ) {
1224                 // Lazily create the event:
1225                 // if (changeEvent == null)
1226                 // changeEvent = new ChangeEvent(this);
1227                 ((ItemListener)listeners[i+1]).itemStateChanged(e);
1228             }
1229         }
1230     }
1231 
1232     /**
1233      * Notifies all listeners that have registered interest for
1234      * notification on this event type.
1235      *
1236      * @see EventListenerList
1237      */

1238     protected void fireActionEvent() {
1239         if (!firingActionEvent) {
1240             // Set flag to ensure that an infinite loop is not created
1241             firingActionEvent = true;
1242             ActionEvent e = null;
1243             // Guaranteed to return a non-null array
1244             Object[] listeners = listenerList.getListenerList();
1245             long mostRecentEventTime = EventQueue.getMostRecentEventTime();
1246             int modifiers = 0;
1247             AWTEvent currentEvent = EventQueue.getCurrentEvent();
1248             if (currentEvent instanceof InputEvent) {
1249                 modifiers = ((InputEvent)currentEvent).getModifiers();
1250             } else if (currentEvent instanceof ActionEvent) {
1251                 modifiers = ((ActionEvent)currentEvent).getModifiers();
1252             }
1253             try {
1254                 // Process the listeners last to first, notifying
1255                 // those that are interested in this event
1256                 for ( int i = listeners.length-2; i>=0; i-=2 ) {
1257                     if ( listeners[i]==ActionListener.class ) {




1218         // Guaranteed to return a non-null array
1219         Object[] listeners = listenerList.getListenerList();
1220         // Process the listeners last to first, notifying
1221         // those that are interested in this event
1222         for ( int i = listeners.length-2; i>=0; i-=2 ) {
1223             if ( listeners[i]==ItemListener.class ) {
1224                 // Lazily create the event:
1225                 // if (changeEvent == null)
1226                 // changeEvent = new ChangeEvent(this);
1227                 ((ItemListener)listeners[i+1]).itemStateChanged(e);
1228             }
1229         }
1230     }
1231 
1232     /**
1233      * Notifies all listeners that have registered interest for
1234      * notification on this event type.
1235      *
1236      * @see EventListenerList
1237      */
1238     @SuppressWarnings("deprecation")
1239     protected void fireActionEvent() {
1240         if (!firingActionEvent) {
1241             // Set flag to ensure that an infinite loop is not created
1242             firingActionEvent = true;
1243             ActionEvent e = null;
1244             // Guaranteed to return a non-null array
1245             Object[] listeners = listenerList.getListenerList();
1246             long mostRecentEventTime = EventQueue.getMostRecentEventTime();
1247             int modifiers = 0;
1248             AWTEvent currentEvent = EventQueue.getCurrentEvent();
1249             if (currentEvent instanceof InputEvent) {
1250                 modifiers = ((InputEvent)currentEvent).getModifiers();
1251             } else if (currentEvent instanceof ActionEvent) {
1252                 modifiers = ((ActionEvent)currentEvent).getModifiers();
1253             }
1254             try {
1255                 // Process the listeners last to first, notifying
1256                 // those that are interested in this event
1257                 for ( int i = listeners.length-2; i>=0; i-=2 ) {
1258                     if ( listeners[i]==ActionListener.class ) {


< prev index next >