-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatetime.java
More file actions
41 lines (41 loc) · 917 Bytes
/
datetime.java
File metadata and controls
41 lines (41 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class datetime extends MIDlet implements CommandListener
{
private Display display;
private Form form;
private Date today;
private Command exit;
private DateField datefield;
public datetime()
{
display = Display.getDisplay(this);
form = new Form("Today's Date");
today = new Date(System.currentTimeMillis());
datefield = new DateField("", DateField.DATE_TIME);
datefield.setDate(today);
exit = new Command("Exit", Command.EXIT, 1);
form.append(datefield);
form.addCommand(exit);
form.setCommandListener(this);
}
public void startApp ()
{
display.setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command command, Displayable displayable)
{
if (command == exit)
{
destroyApp(false);
notifyDestroyed();
}
}
}