?? getkeycodecanvas.java
字號(hào):
package zxhwolfe;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Font;
public class GetKeycodeCanvas extends Canvas
{
int keyCode;
int gameAction;
String keyName;
boolean isDoubleBuffered = isDoubleBuffered();
static int state;
static int use;
public GetKeycodeCanvas(GetKeycode getkyecode)
{
}
public synchronized void keyPressed(int i)
{
keyCode = i;
gameAction = getGameAction(i);
keyName = getKeyName(i);
System.out.println(keyCode);
System.out.println(gameAction);
System.out.println(keyName);
System.out.println(isDoubleBuffered);
if (i==56||i==53||i==50||i==48){
if (i == 48 && state != 4)
{
state = 4;
} else if (i == 48 && state == 4)
{
use= 2;//jinrujsr
state= 0;
}
if (i == 56 && state != 2)
{
state = 2;
} else if (i == 56 && state == 2)
{
GetKeycode.quitApp();
}
if (i == 53 && state != 3)
{
state = 3;
} else if (i == 53 && state == 3)
{
use= 1;//jinrujiance
state= 0;
}
if (i == 50 && state != 5)
{
state = 5;
} else if (i == 50 && state == 5)
{
use= 0;//fanhui anjianceshi
state= 0;
} }
else{
state=0;
}
repaint();
}
protected void paint(Graphics g)
{
g.setFont(Font.getFont(0,0,Font.SIZE_SMALL));
g.setColor(0x00FFFFFF);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(0x00000000);
switch(use){
case 0:
g.drawString("現(xiàn)在進(jìn)行的是按鍵測試:", 3, 0, 0);
g.drawString("You pressed:", 3, 15, 0);
g.drawString("Code:" + keyCode, 3, 30, 0);
g.drawString("Action:" + gameAction, 3, 45, 0);
g.drawString("Name:" + keyName, 3, 60, 0);
g.drawString("連續(xù)按55鍵進(jìn)入手機(jī)屬性", 3, 80, 0);
g.drawString("連續(xù)按22鍵返回按鍵測試", 3, 95, 0);
g.drawString("連續(xù)按00鍵進(jìn)入手機(jī)JSR", 3, 110, 0);
g.drawString("連續(xù)按" + "\"88\"鍵" + "退出.", 3, 125, 0);
break;
case 1:
String s = System.getProperty("microedition.configuration");
g.drawString(getValue("硬件平臺(tái):", s ), 3, 0, 0);
s = System.getProperty("microedition.platform");
g.drawString(getValue("軟件平臺(tái):", s ), 3, 15, 0);
s = System.getProperty("microedition.encoding");
g.drawString(getValue("系統(tǒng)編碼:", s ), 3, 30, 0);
s = System.getProperty("microedition.locale");
g.drawString(getValue("區(qū)域設(shè)置:", s ), 3, 45, 0);
s = System.getProperty("microedition.profiles");
g.drawString(getValue("MIDP(JSR37or118):", s ), 3, 60, 0);
g.drawString(isDoubleBuffered==true?"支持雙緩沖":"不支持雙緩沖", 3, 75, 0);
String sSupported = System.getProperty("supports.mixing");
if(sSupported == null)
{
sSupported = "不支持";
}
g.drawString("支持混音:" + sSupported,3,90,0);
g.drawString("連續(xù)按22鍵返回按鍵測試", 3, 110, 0);
g.drawString("連續(xù)按00鍵進(jìn)入手機(jī)JSR", 3, 125, 0);
// g.drawString("連續(xù)按" + "\"88\"鍵" + "退出.", 3, 125, 0);
break;
case 2:
s = System.getProperty("microedition.jtwi.version");
g.drawString(getValue("JTWI(JSR185):", s ), 3, 0, 0);
s = System.getProperty("microedition.media.version");
g.drawString(getValue("MMA(JSR135):",s ), 3, 15, 0);
s = System.getProperty("wireless.messaging.sms.smsc");
if(s != null)
{
g.drawString("WMA支持:"+"SMS:"+ s , 3, 30, 0);
s = System.getProperty("wireless.messaging.mms.mmsc");
g.drawString("MMS:"+ s , 3, 45, 0);
} else
{
g.drawString("WMA不支持!" ,3, 30, 0);
}
s = System.getProperty("bluetooth.api.version");
g.drawString(getValue("BlueTooth(JSR82):", s) , 3, 60, 0);
s = System.getProperty("microedition.pim.version");
g.drawString(getValue("PIM(JSR75):", s ), 3, 75, 0);
s = System.getProperty("microedition.io.file.FileConnection.version");
g.drawString(getValue("FileConnection:",s ), 3, 90, 0);
s = System.getProperty("microedition.sip.version");
g.drawString(getValue("SIP(JSR180):", s ), 3, 105, 0);
s = System.getProperty("microedition.m3g.version");
g.drawString(getValue("M3G(JSR184):", s) , 3, 120, 0);
break;
}
}
private String getValue(String prompt, String s)
{
return prompt + ":" + (s != null ? s : "不支持") ;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -