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
This commit is contained in:
parent
20afd47571
commit
a0ea855073
16 changed files with 1919 additions and 144 deletions
|
@ -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);
|
||||
}
|
||||
public void removeActionListener(ActionListener listener)
|
||||
{
|
||||
actions.removeElement(listener);
|
||||
}
|
||||
|
||||
void fireActionPerformed()
|
||||
{
|
||||
for (int i=0;i<actions.size();i++)
|
||||
{
|
||||
ActionListener a = (ActionListener) actions.elementAt(i);
|
||||
a.actionPerformed(new ActionEvent(this, ticks, "Timer"));
|
||||
}
|
||||
listenerList.add (ActionListener.class, listener);
|
||||
}
|
||||
|
||||
public void removeActionListener(ActionListener 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);
|
||||
}
|
||||
|
||||
protected void fireActionPerformed (ActionEvent event)
|
||||
{
|
||||
ActionListener[] listeners = getActionListeners();
|
||||
|
||||
for (int i = 0; i < listeners.length; i++)
|
||||
{
|
||||
listeners [i].actionPerformed (event);
|
||||
}
|
||||
}
|
||||
|
||||
void fireActionPerformed ()
|
||||
{
|
||||
fireActionPerformed (new ActionEvent (this, ticks, "Timer"));
|
||||
}
|
||||
|
||||
public static void setLogTimers(boolean flag)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue