Forums Register Login

System Information Code not running

+Pie Number of slices to send: Send
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
public class SysInfo extends MIDlet implements CommandListener {
private Command exitCommand;
private Display display;
private Form screen;
public SysInfo() {
// Get the Display object for the MIDlet
display = Display.getDisplay(this);
// Create the Exit command
exitCommand = new Command("Exit", Command.EXIT, 2);
// Create the main screen form
screen = new Form("SysInfo");
// Obtain the current time
Calendar calendar = Calendar.getInstance();
String time = Integer.toString(calendar.get(Calendar.HOUR)) + ":" +
Integer.toString(calendar.get(Calendar.MINUTE)) + ":" +
Integer.toString(calendar.get(Calendar.SECOND));
// Obtain the total and free memory, and convert them to strings
Runtime runtime = Runtime.getRuntime();
String totalMem = Long.toString(runtime.totalMemory());
String freeMem = Long.toString(runtime.freeMemory());
// Obtain the display properties
String isColor = display.isColor() ? "Yes" : "No";
String numColors = Integer.toString(display.numColors());
// Create string items and add them to the screen
screen.append(new StringItem("", "Time: " + time));
screen.append(new StringItem("", "Total mem: " + totalMem));
screen.append(new StringItem("", "Free mem: " + freeMem));
screen.append(new StringItem("", "Color: " + isColor));
screen.append(new StringItem("", "# of colors: " + numColors));
// Set the Exit command
screen.addCommand(exitCommand);
screen.setCommandListener(this);
}
public void startApp() throws MIDletStateChangeException {
// Set the current display to the screen
display.setCurrent(screen);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}
+Pie Number of slices to send: Send
What do you mean by "not running"?
PS. Using the UBB [CODE]tags[/CODE] makes it easier for others to read your code snippets
Enjoy the full beauty of the english language. Embedded in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 946 times.
Similar Threads
J2Me datagram connection with multicast socket server
Getting Live Data Problem Problem
Please help in reading a file
Please help out in XML problem
MP3/J2ME
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:39:33.