read more...
Monday, March 22, 2010
Timer : Snooze.java
/*--------------------------------------------------
* Snooze.java
*
* Example from the book: Core J2ME Technology
* Copyright John W. Muchow http://www.CoreJ2ME.com
* You may use/modify for any non-commercial purpose
*-------------------------------------------------*/
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.Timer;
import java.util.TimerTask;
public class Snooze extends MIDlet implements ItemStateListener, CommandListener
{
private Display display; // Reference to display object
private Form fmMain; // The main form
private Command cmSnooze; // Start the timer
private Command cmReset; // Reset to current date/time
private Command cmExit; // Exit the MIDlet
private DateField dfSnoozeTime; // How long to snooze
private int dateIndex; // Index of the DateField on the Form
private Date currentTime; // Current time...changes when pressing reset
private Timer tmSnooze; // The timer - keeps track of system time
private SnoozeTimer ttSnooze; // Called by the timer
private boolean dateOK = false; // Was the user input valid?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment