This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GUI] Patch: javax.swing.Timer


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I just commited the attached patch to add the offical 
javax.swing.Timer constructor and use this instead of the default 
implicit one.


Michael


2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/Timer.java
	(Timer): New constructor.
	* javax/swing/plaf/basic/BasicProgressBarUI.java
	(animationTimer): Don't initialize at construction.
	(startAnimationTimer): Added since tag.
	(stopAnimationTimer): Likewise.
	(installUI): Use new Timer constructor.
	* javax/swing/plaf/basic/BasicScrollBarUI.java
	(installUI): Likewise.
	* javax/swing/plaf/basic/BasicSliderUI.java
	(installUI): Likewise.


- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAyDlZWSOgCCdjSDsRAp5oAJ0Z1H9WCG4hpR09nsDdLLe5xW/FRgCfV90a
opcJ4yI1bqP3ZVOIriehCZg=
=+F7y
-----END PGP SIGNATURE-----
Index: javax/swing/Timer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/Timer.java,v
retrieving revision 1.3.18.3
diff -u -b -B -r1.3.18.3 Timer.java
--- javax/swing/Timer.java	7 Jun 2004 14:00:36 -0000	1.3.18.3
+++ javax/swing/Timer.java	10 Jun 2004 10:32:15 -0000
@@ -87,6 +87,14 @@
     }
   }
 
+  public Timer(int delay, ActionListener listener)
+  {
+    interval = delay;
+
+    if (listener != null)
+      addActionListener(listener);
+  }
+
   public void addActionListener(ActionListener listener)
   {
     listenerList.add (ActionListener.class, listener);
Index: javax/swing/plaf/basic/BasicProgressBarUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicProgressBarUI.java,v
retrieving revision 1.1.2.3
diff -u -b -B -r1.1.2.3 BasicProgressBarUI.java
--- javax/swing/plaf/basic/BasicProgressBarUI.java	21 May 2004 23:34:15 -0000	1.1.2.3
+++ javax/swing/plaf/basic/BasicProgressBarUI.java	10 Jun 2004 10:32:15 -0000
@@ -134,8 +134,7 @@
   }
 
   /** The timer used to move the bouncing box. */
-  private transient Timer animationTimer = new Timer();
-
+  private transient Timer animationTimer;
 
   // The total number of frames must be an even number.
   // The total number of frames is calculated from
@@ -681,6 +680,8 @@
    * This method starts the animation timer. It is called
    * when the propertyChangeListener detects that the progressBar
    * has changed to indeterminate mode.
+   *
+   * @since 1.4
    */
   protected void startAnimationTimer()
   {
@@ -692,6 +693,8 @@
    * This method stops the animation timer. It is called when
    * the propertyChangeListener detects that the progressBar
    * has changed to determinate mode.
+   *
+   * @since 1.4
    */
   protected void stopAnimationTimer()
   {
@@ -794,7 +797,7 @@
       {
 	progressBar = (JProgressBar) c;
 
-	animationTimer = new Timer();
+	animationTimer = new Timer(200, null);
 	animationTimer.setRepeats(true);
 
 	installDefaults();
Index: javax/swing/plaf/basic/BasicScrollBarUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java,v
retrieving revision 1.1.2.6
diff -u -b -B -r1.1.2.6 BasicScrollBarUI.java
--- javax/swing/plaf/basic/BasicScrollBarUI.java	9 Jun 2004 08:40:09 -0000	1.1.2.6
+++ javax/swing/plaf/basic/BasicScrollBarUI.java	10 Jun 2004 10:32:15 -0000
@@ -957,8 +957,7 @@
 	trackRect = new Rectangle();
 	thumbRect = new Rectangle();
 
-	scrollTimer = new Timer();
-	scrollTimer.setDelay(200);
+	scrollTimer = new Timer(200, null);
 	scrollTimer.setRepeats(true);
 
 	installComponents();
Index: javax/swing/plaf/basic/BasicSliderUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicSliderUI.java,v
retrieving revision 1.1.2.9
diff -u -b -B -r1.1.2.9 BasicSliderUI.java
--- javax/swing/plaf/basic/BasicSliderUI.java	9 Jun 2004 08:40:09 -0000	1.1.2.9
+++ javax/swing/plaf/basic/BasicSliderUI.java	10 Jun 2004 10:32:16 -0000
@@ -618,8 +618,7 @@
 	insetCache = slider.getInsets();
 	leftToRightCache = ! slider.getInverted();
 
-	scrollTimer = new Timer();
-	scrollTimer.setDelay(200);
+	scrollTimer = new Timer(200, null);
 	scrollTimer.setRepeats(true);
 
 	installDefaults(slider);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]