0% found this document useful (0 votes)
34 views2 pages

Prac 3

This document contains code for a Java MIDlet application that displays the current date and time on a mobile device. The application uses classes like Display, Form, DateField, and Command to create a user interface with a date/time field and exit button. When started, it gets the current system time, sets the date field to display it, adds the exit command, and sets a command listener to close the application when exit is selected.

Uploaded by

Ronak Doshi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

Prac 3

This document contains code for a Java MIDlet application that displays the current date and time on a mobile device. The application uses classes like Display, Form, DateField, and Command to create a user interface with a date/time field and exit button. When started, it gets the current system time, sets the date field to display it, adds the exit command, and sets a command listener to close the application when exit is selected.

Uploaded by

Ronak Doshi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

CE-II 7TH SEM ID: 08CE48 Program Code: import java.util.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.

*;

MOBILE COMPUTING

public class DateToday1 extends MIDlet implements CommandListener { private Display display; private Form form; private Date today; private Command exit; private DateField datefield; public DateToday() { 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(); } } }

Department Of Computer Engineering

PAGE:____

CE-II 7TH SEM ID: 08CE48 Output:

MOBILE COMPUTING

Department Of Computer Engineering

PAGE:____

You might also like