Source code: com/barteo/midp/examples/simpledemo/DateFieldPanel.java
1 /*
2 * MicroEmulator
3 * Copyright (C) 2001 Bartek Teodorczyk <barteo@it.pl>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 package com.barteo.midp.examples.simpledemo;
21
22 import javax.microedition.lcdui.*;
23
24
25 public class DateFieldPanel extends Form implements ScreenPanel, CommandListener
26 {
27
28 static String NAME = "DateField";
29
30 Command backCommand = new Command("Back", Command.BACK, 1);
31
32
33 public DateFieldPanel()
34 {
35 super(NAME);
36
37 append(new DateField("Time", DateField.TIME));
38 append(new DateField("Date & time", DateField.DATE_TIME));
39
40 addCommand(backCommand);
41 setCommandListener(this);
42 }
43
44
45 public String getName()
46 {
47 return NAME;
48 }
49
50
51 public void commandAction(Command c, Displayable d)
52 {
53 if (d == this) {
54 if (c == backCommand) {
55 Display.getDisplay(SimpleDemo.getInstance()).setCurrent(SimpleDemo.getInstance().menuList);
56 }
57 }
58 }
59
60 }