aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/Timer.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-06-24 09:48:43 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-06-24 09:48:43 +0000
commita0ea8550734007723696ff2f3d8ce38f1df6078c (patch)
tree73b283b47a017c9d99909acd2ee187905fd6db24 /libjava/javax/swing/Timer.java
parent20afd4757112345a1f7d9eabe4ff0d6e772a8701 (diff)
downloadgcc-a0ea8550734007723696ff2f3d8ce38f1df6078c.zip
gcc-a0ea8550734007723696ff2f3d8ce38f1df6078c.tar.gz
gcc-a0ea8550734007723696ff2f3d8ce38f1df6078c.tar.bz2
Timer.java, [...]: New versions from classpath.
2003-06-24 Michael Koch <konqueror@gmx.de> * javax/swing/Timer.java, javax/swing/plaf/ActionMapUIResource.java, javax/swing/plaf/ButtonUI.java, javax/swing/plaf/ColorChooserUI.java, javax/swing/plaf/ColorUIResource.java, javax/swing/plaf/ComboBoxUI.java, javax/swing/plaf/ComponentInputMapUIResource.java, javax/swing/plaf/basic/BasicBorders.java: New versions from classpath. * javax/swing/plaf/basic/BasicSplitPaneDivider.java. javax/swing/plaf/basic/BasicSplitPaneUI.java: New file from classpath. * javax/swing/plaf/basic/doc-files/BasicBorders-1.png, javax/swing/plaf/basic/doc-files/BasicBorders-2.png, javax/swing/plaf/basic/doc-files/BasicBorders.FieldBorder-1.png, javax/swing/plaf/doc-files/ComponentUI-1.dia, javax/swing/plaf/doc-files/ComponentUI-1.png: New binary files from classpath. From-SVN: r68409
Diffstat (limited to 'libjava/javax/swing/Timer.java')
-rw-r--r--libjava/javax/swing/Timer.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/libjava/javax/swing/Timer.java b/libjava/javax/swing/Timer.java
index 80eb13a..89df756 100644
--- a/libjava/javax/swing/Timer.java
+++ b/libjava/javax/swing/Timer.java
@@ -47,12 +47,13 @@ import javax.swing.event.EventListenerList;
public class Timer implements Serializable
{
+ protected EventListenerList listenerList = new EventListenerList();
+
int ticks;
static boolean verbose;
boolean running;
boolean repeat_ticks = true;
long interval, init_delay;
- Vector actions = new Vector();
class Waker extends Thread
{
@@ -86,23 +87,44 @@ public class Timer implements Serializable
public void addActionListener(ActionListener listener)
{
- actions.addElement(listener);
+ listenerList.add (ActionListener.class, listener);
}
+
public void removeActionListener(ActionListener listener)
{
- actions.removeElement(listener);
+ listenerList.remove (ActionListener.class, listener);
+ }
+
+ /**
+ * @since 1.3
+ */
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public ActionListener[] getActionListeners ()
+ {
+ return (ActionListener[]) listenerList.getListeners (ActionListener.class);
}
- void fireActionPerformed()
+ protected void fireActionPerformed (ActionEvent event)
{
- for (int i=0;i<actions.size();i++)
+ ActionListener[] listeners = getActionListeners();
+
+ for (int i = 0; i < listeners.length; i++)
{
- ActionListener a = (ActionListener) actions.elementAt(i);
- a.actionPerformed(new ActionEvent(this, ticks, "Timer"));
+ listeners [i].actionPerformed (event);
}
}
-
+ void fireActionPerformed ()
+ {
+ fireActionPerformed (new ActionEvent (this, ticks, "Timer"));
+ }
public static void setLogTimers(boolean flag)
{