import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
public class J2MECheckColor extends MIDlet implements CommandListener {
private Display display;
private Form form;
private TextBox textbox;
private Command exit = new Command("Exit", Command.SCREEN, 1);
public J2MECheckColor() {
display = Display.getDisplay(this);
String message = null;
if (display.isColor()) {
message = "Color display.";
} else {
message = "No color display";
}
textbox = new TextBox("Check Colors", message, 17, 0);
textbox.addCommand(exit);
textbox.setCommandListener(this);
}
public void startApp() {
display.setCurrent(textbox);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable displayable) {
if (command == exit) {
destroyApp(true);
notifyDestroyed();
}
}
}