yu.ac.bg.etf.javaqx.qswing
Class JQTimer

java.lang.Object
  extended byyu.ac.bg.etf.javaqx.qswing.JQTimer

public class JQTimer
extends java.lang.Object

Timer Class.

NOTE: JQTimer object is garbage collectable - there are no hidden references on it!

Version:
0.2.0
Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Field Summary
protected  EventListenerList listenerList
           
 
Constructor Summary
JQTimer(int delay)
          Constructs new JQTimer object.
JQTimer(int delay, ActionListener listener)
          Constructs new JQTimer object.
JQTimer(int delay, int initialDelay, ActionListener listener)
          Constructs new JQTimer object.
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds action listener.
protected  void finalize()
          
protected  void fireActionPerformed(ActionEvent e)
          Fires action event.
 ActionListener[] getActionListeners()
          Returns all action listeners.
 int getDelay()
          Returns delay.
 int getInitialDelay()
          Return initial delay.
 boolean isRepeats()
          Returns true if the timer is sending an action event to its listeners multiple times.
 boolean isRunning()
          Returns true if the timer is running.
 void removeActionListener(ActionListener listener)
          Removes action listener.
 void restart()
          Restarts the timer.
 void setDelay(int delay)
          Sets delay.
 void setInitialDelay(int initialDelay)
          Sets delay.
 void setRepeats(boolean repeats)
          If repeats is false the timer will send only one action event to its listeners.
 void start()
          Starts the timer.
 void start(int initialDelay)
          Starts the timer.
 void stop()
          Stops the timer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected final EventListenerList listenerList
Constructor Detail

JQTimer

public JQTimer(int delay,
               int initialDelay,
               ActionListener listener)
Constructs new JQTimer object.

Parameters:
delay - the number of milliseconds between action events
initialDelay - the initial delay
listener - the listener

JQTimer

public JQTimer(int delay,
               ActionListener listener)
Constructs new JQTimer object.

Parameters:
delay - the number of milliseconds between action events
listener - the listener

JQTimer

public JQTimer(int delay)
Constructs new JQTimer object.

Parameters:
delay - the number of milliseconds between action events
Method Detail

addActionListener

public void addActionListener(ActionListener listener)
Adds action listener.

Parameters:
listener - the action listener

removeActionListener

public void removeActionListener(ActionListener listener)
Removes action listener.

Parameters:
listener - the action listener

getActionListeners

public ActionListener[] getActionListeners()
Returns all action listeners.

Returns:
the action listener array

getDelay

public int getDelay()
Returns delay.

Returns:
delay

setDelay

public void setDelay(int delay)
Sets delay.

Parameters:
delay - the delay
Throws:
java.lang.IllegalArgumentException - if (delay < 0)

getInitialDelay

public int getInitialDelay()
Return initial delay.

Returns:
initial delay

setInitialDelay

public void setInitialDelay(int initialDelay)
Sets delay.

Parameters:
initialDelay - the initial delay
Throws:
java.lang.IllegalArgumentException - if (delay < 0)

isRepeats

public boolean isRepeats()
Returns true if the timer is sending an action event to its listeners multiple times.

Returns:
true if the timer is sending an action event to its listeners multiple times

setRepeats

public void setRepeats(boolean repeats)
If repeats is false the timer will send only one action event to its listeners.

Parameters:
repeats - the repeats flag

isRunning

public boolean isRunning()
Returns true if the timer is running.

Returns:
true if the timer is running

start

public void start(int initialDelay)
Starts the timer.

Parameters:
initialDelay - the initial delay

start

public void start()
Starts the timer.


stop

public void stop()
Stops the timer.


restart

public void restart()
Restarts the timer.


fireActionPerformed

protected void fireActionPerformed(ActionEvent e)
Fires action event.

Parameters:
e - the action event

finalize

protected void finalize()



Copyright © 2007 ETF and contributors. All Rights Reserved.