?? welcomecanvas.java
字號:
package AdressList;
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 WelcomeCanvas extends Canvas implements CommandListener{
private Command cmdPhone = new Command("電話本",Command.SCREEN,1);
private Command cmdExit = new Command("退出",Command.EXIT,1);
private PhoneMIDlet pm;
public WelcomeCanvas(PhoneMIDlet pm){
this.pm = pm;
this.addCommand(cmdPhone);
this.addCommand(cmdExit);
this.setCommandListener(this);
}
public void commandAction(Command c,Displayable d){
if(c==cmdPhone){
pm.changeInterface("PhoneList");
}
else if(c==cmdExit){
pm.notifyDestroyed();
}
}
public void paint(Graphics g){
String str = "歡迎光臨";
g.setFont(Font.getFont(Font.FACE_SYSTEM,Font.STYLE_BOLD,Font.SIZE_LARGE));
g.setColor(255,0,0);
g.drawString(str, this.getWidth()/2, 50, Graphics.TOP|Graphics.HCENTER);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -