< prev index next >

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

Print this page




1737      *
1738      * @see #addActionListener
1739      * @see #removeActionListener
1740      *
1741      * @since 1.4
1742      */
1743     @BeanProperty(bound = false)
1744     public ActionListener[] getActionListeners() {
1745         return listenerList.getListeners(ActionListener.class);
1746     }
1747 
1748     /**
1749      * Notifies all listeners that have registered interest for
1750      * notification on this event type. The event instance
1751      * is lazily created using the <code>command</code> parameter.
1752      *
1753      * @param command a string that may specify a command associated with
1754      *                the event
1755      * @see EventListenerList
1756      */

1757     protected void fireActionPerformed(String command) {
1758         // Guaranteed to return a non-null array
1759         Object[] listeners = listenerList.getListenerList();
1760         long mostRecentEventTime = EventQueue.getMostRecentEventTime();
1761         int modifiers = 0;
1762         AWTEvent currentEvent = EventQueue.getCurrentEvent();
1763         if (currentEvent instanceof InputEvent) {
1764             modifiers = ((InputEvent)currentEvent).getModifiers();
1765         } else if (currentEvent instanceof ActionEvent) {
1766             modifiers = ((ActionEvent)currentEvent).getModifiers();
1767         }
1768         ActionEvent e = null;
1769         // Process the listeners last to first, notifying
1770         // those that are interested in this event
1771         for (int i = listeners.length-2; i>=0; i-=2) {
1772             if (listeners[i]==ActionListener.class) {
1773                 // Lazily create the event:
1774                 if (e == null) {
1775                     e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
1776                                         command, mostRecentEventTime,




1737      *
1738      * @see #addActionListener
1739      * @see #removeActionListener
1740      *
1741      * @since 1.4
1742      */
1743     @BeanProperty(bound = false)
1744     public ActionListener[] getActionListeners() {
1745         return listenerList.getListeners(ActionListener.class);
1746     }
1747 
1748     /**
1749      * Notifies all listeners that have registered interest for
1750      * notification on this event type. The event instance
1751      * is lazily created using the <code>command</code> parameter.
1752      *
1753      * @param command a string that may specify a command associated with
1754      *                the event
1755      * @see EventListenerList
1756      */
1757     @SuppressWarnings("deprecation")
1758     protected void fireActionPerformed(String command) {
1759         // Guaranteed to return a non-null array
1760         Object[] listeners = listenerList.getListenerList();
1761         long mostRecentEventTime = EventQueue.getMostRecentEventTime();
1762         int modifiers = 0;
1763         AWTEvent currentEvent = EventQueue.getCurrentEvent();
1764         if (currentEvent instanceof InputEvent) {
1765             modifiers = ((InputEvent)currentEvent).getModifiers();
1766         } else if (currentEvent instanceof ActionEvent) {
1767             modifiers = ((ActionEvent)currentEvent).getModifiers();
1768         }
1769         ActionEvent e = null;
1770         // Process the listeners last to first, notifying
1771         // those that are interested in this event
1772         for (int i = listeners.length-2; i>=0; i-=2) {
1773             if (listeners[i]==ActionListener.class) {
1774                 // Lazily create the event:
1775                 if (e == null) {
1776                     e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
1777                                         command, mostRecentEventTime,


< prev index next >