/[classpath]/classpath/javax/swing/Timer.java
ViewVC logotype

Diff of /classpath/javax/swing/Timer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mkoch, Sun Jun 8 11:43:14 2003 UTC revision 1.5 by mkoch, Tue Jun 24 05:32:26 2003 UTC
# Line 47  import javax.swing.event.EventListenerLi Line 47  import javax.swing.event.EventListenerLi
47    
48  public class Timer implements Serializable  public class Timer implements Serializable
49  {  {
50      protected EventListenerList listenerList = new EventListenerList();
51      
52    int ticks;    int ticks;
53    static boolean verbose;    static boolean verbose;
54    boolean running;    boolean running;
55    boolean repeat_ticks = true;    boolean repeat_ticks = true;
56    long interval, init_delay;    long interval, init_delay;
   Vector actions = new Vector();  
57            
58    class Waker extends Thread    class Waker extends Thread
59    {    {
# Line 86  public class Timer implements Serializab Line 87  public class Timer implements Serializab
87    
88    public void addActionListener(ActionListener listener)    public void addActionListener(ActionListener listener)
89    {    {
90      actions.addElement(listener);      listenerList.add (ActionListener.class, listener);
91    }    }
92      
93    public void removeActionListener(ActionListener listener)    public void removeActionListener(ActionListener listener)
94    {    {
95      actions.removeElement(listener);      listenerList.remove (ActionListener.class, listener);
96      }
97    
98      /**
99       * @since 1.3
100       */
101      public EventListener[] getListeners (Class listenerType)
102      {
103        return listenerList.getListeners (listenerType);
104      }
105      
106      /**
107       * @since 1.4
108       */
109      public ActionListener[] getActionListeners ()
110      {
111        return (ActionListener[]) listenerList.getListeners (ActionListener.class);
112    }    }
113    
114    void fireActionPerformed()    protected void fireActionPerformed (ActionEvent event)
115    {    {
116      for (int i=0;i<actions.size();i++)      ActionListener[] listeners = getActionListeners();
117        
118        for (int i = 0; i < listeners.length; i++)
119        {        {
120          ActionListener a = (ActionListener) actions.elementAt(i);          listeners [i].actionPerformed (event);
         a.actionPerformed(new ActionEvent(this, ticks, "Timer"));  
121        }        }
122    }    }
     
123    
124      void fireActionPerformed ()
125      {
126        fireActionPerformed (new ActionEvent (this, ticks, "Timer"));
127      }
128    
129    public static void setLogTimers(boolean flag)    public static void setLogTimers(boolean flag)
130    {    {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26