📄 timetest.java
字号:
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
public class timeTest extends MIDlet {
Display display;
public timeTest() {
// TODO 自动生成构造函数存根
display=Display.getDisplay(this);
MainMenu menu=new MainMenu(display);
Image image=null;
try{
image=Image.createImage("/res/bg.png");
}
catch(Exception e)
{}
Alert splashScreen = new Alert( "手机游戏","显示文本",image,AlertType.ALARM);
splashScreen.setTimeout(4000);
display.setCurrent(splashScreen,menu);
//display.setCurrent(menu);
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO 自动生成构造函数存根��
}
protected void pauseApp() {
// TODO 自动生成构造函数存根�
}
protected void startApp() throws MIDletStateChangeException {
// TODO 自动生成构造函数存根
}
}
class MainMenu extends Canvas implements CommandListener{
Display test;
Graphics g=null;
int width=getWidth();
int height=getHeight();
String menu[]={"开始游戏","游戏设置","游戏说明"};
public MainMenu(Display display){
test=display;
paint(g);
}
public void commandAction(Command c,Displayable d){
}
public void paint(Graphics g){
//int color = g.getColor();
g.setColor(0xffffff);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0x000000);
//g.setColor(0x00808080);
// for(int i=0;i<menu.length;i++){
// g.drawString(menu[i], width, height, Graphics.VCENTER);
// }
g.drawString("aa", width, height,Graphics.HCENTER| Graphics.BOTTOM);
System.out.println(width);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -