?? mainscreen_2.java
字號:
package lckz;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
public class MainScreen_2 extends Canvas implements CommandListener
{
private static Displayable instance;
String[] str={"開始","設定","版權聲明","離開"};
int curMenu,y0=50;
synchronized public static Displayable getInstance()
{
if(instance==null)
{
instance=new MainScreen_2();
}
return instance;
}
public MainScreen_2()
{
setCommandListener(this);
}
protected void paint(Graphics g) {
// TODO 自動生成方法存根
g.setColor(0x000000);
g.fillRect(0,0,getWidth(),getHeight());
for (int i = 0; i < str.length; i++) {
if (i == curMenu) {
g.setColor(0xff00ff00);
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD
| Font.STYLE_ITALIC, Font.SIZE_LARGE));
g.drawString(str[i], getWidth() / 2, y0 + 30 * i,
Graphics.HCENTER | Graphics.TOP);
} else {
g.setColor(0xff00ff00);
g.setFont(Font.getDefaultFont());
g.drawString(str[i], getWidth() / 2, y0 + 30 * i,
Graphics.HCENTER | Graphics.TOP);
}
}
}
public void commandAction(Command c, Displayable d) {
// TODO 自動生成方法存根
String cmd=str[0];
Navigator.flow(cmd);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -