?? devcap.java
字號:
//DevCap.java file
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class DevCap extends MIDlet implements CommandListener
{
private Command exitCommand;
private Canvas canvas;
public DevCap()
{
exitCommand =new Command("Exit",Command.EXIT,1);
canvas = new Canvas(){public void paint(Graphics g){}};
canvas.addCommand(exitCommand);
canvas.setCommandListener(this);
}
protected void startApp( ) throws MIDletStateChangeException
{
devCapability(Display.getDisplay(this),canvas);
devCapability2(Display.getDisplay(this));
Display.getDisplay(this).setCurrent(canvas);
}
protected void pauseApp( )
{
}
protected void destroyApp( boolean p1 )
{
}
public void commandAction(Command c,Displayable d)
{
if (c ==exitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
public static void devCapability(Display d, Canvas c)
{//在支持MIDP v1.0、v2.0的設(shè)備中運行
System.out.println("支持彩色 " + d.isColor());
System.out.println("顏色數(shù)量 " + d.numColors());
System.out.println("正常屏幕寬度 " + c.getWidth());
System.out.println("正常屏幕高度 " + c.getHeight());
System.out.println("支持指針設(shè)備 " + c.hasPointerEvents());
System.out.println("支持指針設(shè)備拖放 " + c.hasPointerMotionEvents());
System.out.println("支持按鍵重復(fù)事件 " + c.hasRepeatEvents());
}
public static void devCapability2(Display d)
{//只能在支持MIDP v2.0的設(shè)備中運行
System.out.println("AlphaBlend支持程度 " + d.numAlphaLevels()); //小于2表示不支持
System.out.println("List內(nèi)圖標 最佳寬度" + d.getBestImageWidth(d.LIST_ELEMENT));
System.out.println("List內(nèi)圖標 最佳高度" + d.getBestImageHeight(d.LIST_ELEMENT));
System.out.println("ALERT內(nèi)圖標 最佳寬度" + d.getBestImageWidth(d.ALERT));
System.out.println("ALERT內(nèi)圖標 最佳高度" + d.getBestImageHeight(d.ALERT));
System.out.println("ChoiceGroup內(nèi)圖標 最佳寬度" + d.getBestImageWidth(d.CHOICE_GROUP_ELEMENT));
System.out.println("ChoiceGroup內(nèi)圖標 最佳高度" + d.getBestImageHeight(d.CHOICE_GROUP_ELEMENT));
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -