?? myhelp.java
字號:
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import com.nokia.mid.ui.FullCanvas;
public class MyHelp extends FullCanvas
{
private Image back;
//幫助畫面
private static Displayable instance;
//創(chuàng)建并得到一個(gè)幫助畫面的對象
synchronized public static Displayable getInstance()
{
if(instance == null)
instance = new MyHelp();
return instance;
}
//幫助畫面的構(gòu)造方法,加入一個(gè)按鈕
MyHelp()
{
super();
this.setFullScreenMode(true);
back = null;
try
{
back = Image.createImage("/res/back.png");
}
catch(Exception e)
{}
}
protected void keyPressed(int key)
{
if (key == -7)
{
GameMenu.flow("返回");
}
}
//在幫助畫面上寫上說明文字
protected void paint(Graphics g)
{
g.setColor(0,0,0);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(255,255,0);
g.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_PLAIN,Font.SIZE_SMALL));
g.drawImage(back,getWidth(),getHeight(),Graphics.BOTTOM|Graphics.RIGHT);
g.drawString("-游戲說明-",getWidth()/2-30,10,Graphics.TOP|Graphics.LEFT);
g.drawString("移動(dòng):",5,35,Graphics.TOP|Graphics.LEFT);
g.drawString("方向鍵 或 2,4,6,8",5,55,Graphics.TOP|Graphics.LEFT);
g.drawString("跳躍:",5,80,Graphics.TOP|Graphics.LEFT);
g.drawString("向上鍵 或 2",5,100,Graphics.TOP|Graphics.LEFT);
g.drawString("確定:",5,125,Graphics.TOP|Graphics.LEFT);
g.drawString("左功能鍵",5,145,Graphics.TOP|Graphics.LEFT);
g.drawString("返回:",5,170,Graphics.TOP|Graphics.LEFT);
g.drawString("右功能鍵",5,190,Graphics.TOP|Graphics.LEFT);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -