Im trying to create a timer that executes in a seperate thread but i have no clue how to go about formatting the time in h:m:s format. I tried using the java.util.Timer and java.util.TimerTask classes but they are a pain to use so i decided just to use an infinite loop. Thanks
Code:spawnTimerThread(); public void spawnTimerThread(){ DateFormat df = DateFormat.getTimeInstance(); // how do i format to h:m:s Thread timer = new Thread(); t.setDemon(true); // let the vm exit; for(;;){ timer.sleep(1000); // how would i increment the fields } }




Reply With Quote