a simple java timer  
Author Message
Jimbob





PostPosted: 2003-11-27 20:54:00 Top

java-programmer, a simple java timer Just wondering, has anyone here ever used java.swing.timer if so, have you
got any examples? i cant seem to find many on google :s


 
Rhino





PostPosted: 2003-11-27 21:39:00 Top

java-programmer >> a simple java timer
"Jimbob" <email***@***.com> wrote in message
news:Ztmxb.213$email***@***.com...
> Just wondering, has anyone here ever used java.swing.timer if so, have
you
> got any examples? i cant seem to find many on google :s
>
The technique for using a Swing timer is discussed in the Java Tutorial in
the Swing chapter. A complete example, ProgressBarDemo.java, is provided and
discussed in this topic. Links to discussions and examples of
general-purpose timers also appear on that same page.

Here is the URL:
http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html

Rhino


 
Petarian





PostPosted: 2003-11-28 0:16:00 Top

java-programmer >> a simple java timer

--------------040807090404000904040004--

One comment. If you use this timer inside a server process, without any
GUI, make sure to use headless env.
(http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless)

I learned my lesson the hard way :-(

Pete



Rhino wrote:

>"Jimbob" <email***@***.com> wrote in message
>news:Ztmxb.213$email***@***.com...
>
>
>>Just wondering, has anyone here ever used java.swing.timer if so, have
>>
>>
>you
>
>
>>got any examples? i cant seem to find many on google :s
>>
>>
>>
>The technique for using a Swing timer is discussed in the Java Tutorial in
>the Swing chapter. A complete example, ProgressBarDemo.java, is provided and
>discussed in this topic. Links to discussions and examples of
>general-purpose timers also appear on that same page.
>
>Here is the URL:
>http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html
>
>Rhino
>
>
>
>

--

You don't pay to get spam, why pay to clean it?
Visit http://www.spammarshall.com to create an account for free
<http://www.spammarshall.com>




<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
One comment. If you use this timer inside a server process, without any GUI,
make sure to use headless env. (<a class="moz-txt-link-freetext" href="http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless">http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless</a>)<br>
<br>
I learned my lesson the hard way :-(<br>
<br>
Pete<br>
<br>
<br>
<br>
Rhino wrote:<br>
<blockquote type="cite"
cite="midu7nxb.15679$email***@***.com">
<pre wrap="">"Jimbob" <a class="moz-txt-link-rfc2396E" href="mailto:email***@***.com"><email***@***.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:Ztmxb.213$email***@***.com">news:Ztmxb.213$email***@***.com</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Just wondering, has anyone here ever used java.swing.timer if so, have
</pre>
</blockquote>
<pre wrap=""><!---->you
</pre>
<blockquote type="cite">
<pre wrap="">got any examples? i cant seem to find many on google :s

</pre>
</blockquote>
<pre wrap=""><!---->The technique for using a Swing timer is discussed in the Java Tutorial in
the Swing chapter. A complete example, ProgressBarDemo.java, is provided and
discussed in this topic. Links to discussions and examples of
general-purpose timers also appear on that same page.

Here is the URL:
<a class="moz-txt-link-freetext" href="http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html">http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html</a>

Rhino


</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>

<style type="text/css">
P {
font-family: Tahoma, Arial, Verdana;
font-size: 12px;
color: black;
}
H1 {}
H2 {}
H3 {}
HR{
line-height : 1;
text-align : left;
height : 1;
width : 80%;
color : #CC0000;
}
A {}
A:Visited {}
A:Active {}
A:Hover {}
BODY {
font-family: Tahoma, Arial, Verdana;
font-size: 12px;
color: black;
}
table {
font-family: Tahoma, Arial, Verdana;
font-size: 11px;
color: black;
}


</style>
<p> You don't pay to get spam, why pay to clean it?<br>
Visit <a href="http://www.spammarshall.com">http://www.spammarshall.com</a>
to create an account for free<br>
<a href="http://www.spammarshall.com" target="_blank"> <img
src="http://www.spammarshall.com/SpamMarshall/images/logo-g.gif"
border="0">
</a> </p>
</div>
<br>
</body>
</html>

 
 
usenet





PostPosted: 2003-11-28 19:15:00 Top

java-programmer >> a simple java timer Roedy Green <email***@***.com> wrote:


> periodic = new Timer( Config.FADE_UPDATE_FREQUENCY, refresher


frequency != period



Christian
--
And in short, I was afraid.
 
 
Chris Smith





PostPosted: 2003-11-29 0:25:00 Top

java-programmer >> a simple java timer Christian Kaufhold wrote:
> Roedy Green <email***@***.com> wrote:
>
>
> > periodic = new Timer( Config.FADE_UPDATE_FREQUENCY, refresher
>
>
> frequency != period

Christian,

Can you explain further? A common definition of these terms would have
frequency be the multiplicative inverse of period, so that anything with
a frequency would also have a period, and so would qualify as
"periodic". I can't find a more specific definition in the API docs for
javax.swing.Timer, so what are you referring to?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
 
usenet





PostPosted: 2003-11-29 1:18:00 Top

java-programmer >> a simple java timer Chris Smith <email***@***.com> wrote:
> Christian Kaufhold wrote:
>> Roedy Green <email***@***.com> wrote:
>>
>>
>> > periodic = new Timer( Config.FADE_UPDATE_FREQUENCY, refresher
>>
>>
>> frequency != period
>
> Christian,
>
> Can you explain further? A common definition of these terms would have
> frequency be the multiplicative inverse of period, so that anything with
> a frequency would also have a period, and so would qualify as
> "periodic". I can't find a more specific definition in the API docs for
> javax.swing.Timer, so what are you referring to?


The first argument to the Timer constructor is a period (time (actually
milliseconds) between events), not a frequency (number of events per time).

Therefore Config.FADE_UPDATE_FREQUENCY should be called
Config.FADE_UPDATE_PERIOD (or _DELAY, but IMO that does not imply repeti-
on while the Timer clearly seems to be used in periodic mode here).



Christian
--
And in short, I was afraid.
 
 
Chris Smith





PostPosted: 2003-11-29 3:12:00 Top

java-programmer >> a simple java timer > >> Roedy Green <email***@***.com> wrote:
> >> > periodic = new Timer( Config.FADE_UPDATE_FREQUENCY, refresher

Christian Kaufhold wrote:
> The first argument to the Timer constructor is a period (time (actually
> milliseconds) between events), not a frequency (number of events per time).
>
> Therefore Config.FADE_UPDATE_FREQUENCY should be called
> Config.FADE_UPDATE_PERIOD (or _DELAY, but IMO that does not imply repeti-
> on while the Timer clearly seems to be used in periodic mode here).

Right! Gotcha. I just wondered if I'd missed some technical detail
about the way timers worked... instead, it turns out I just wasn't
applying your comment correctly.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation