display

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;


public class DisplayHello extends MIDlet {
	private Display display=Display.getDisplay(this);
	
	Form form=new Form("");
	
	public DisplayHello(){
		super();
		int colors=display.numColors();
		
		boolean iscolors=display.isColor();
		boolean s=display.flashBacklight(2500);
		if (!s) {
			 form.append("sorry,亲,你的设备不支持震动!");
		} 
		if (iscolors) {
			form.append("好吧,亲,你的设备支持彩色显示");
		}
		else {
			form.append("亲,你out了,你的设备不支持彩色显示!!!");
		}
		form.append("你的设备支持"+Integer.toString(colors)+"种颜色");
		
	}
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void startApp() throws MIDletStateChangeException {
		// TODO Auto-generated method stub
		display.getDisplay(this).setCurrent(form);

	}

}

 

你可能感兴趣的:(display)