Wednesday, December 12, 2012
Memperoleh nilai properti sistem pada JAVA (J2ME)
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class PropertiSistem extends MIDlet
implements CommandListener {
private Display display;
private Form form;
private StringBuffer sb;
private final Command cmdKeluar =
new Command("Keluar", Command.EXIT, 1);
public PropertiSistem() {
display = Display.getDisplay(this);
form = new Form("Properti Sistem");
form.addCommand(cmdKeluar);
form.setCommandListener(this);
}
public void startApp() {
sb = getSystemProperties();
StringItem si = new StringItem(null, sb.toString());
form.append(si);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar) {
destroyApp(false);
notifyDestroyed();
}
}
private StringBuffer getSystemProperties() {
StringBuffer temp = new StringBuffer();
temp.append("Versi JTWI: " +
System.getProperty("microedition.jtwi.version"));
temp.append("\nKonfigurasi: " +
System.getProperty("microedition.configuration"));
temp.append("\nProfil: " +
System.getProperty("microedition.profiles"));
temp.append("\nLokal: " +
System.getProperty("microedition.locale"));
temp.append("\nPlatform: " +
System.getProperty("microedition.platform"));
temp.append("\nModel ponsel: " +
System.getProperty("device.model"));
temp.append("\nVersi Software: " +
System.getProperty("software.version"));
temp.append("\nEncoding: " +
System.getProperty("microedition.encoding"));
temp.append("\nPort Komunikasi: " +
System.getProperty("microedition.commports"));
return temp;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment